pretext

Generate single-file HTML demos with DOM-free text layout around obstacles.

Updated May 4, 2026
One-click install
npx skills add https://github.com/JamesFincher/gengar --skill pretext-jamesfincher
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pretext
Source: https://github.com/JamesFincher/gengar/tree/main/skills/creative/pretext
Command: npx skills add https://github.com/JamesFincher/gengar --skill pretext-jamesfincher

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Pretext solves the problem of creating visually rich, browser-native text layouts that must wrap around shapes without expensive DOM measurement and reflow.

Core Features & Use Cases

  • DOM-free text measurement and layout: precompute line breaks, per-line widths, and grapheme positioning from (text, font, width) so you can render confidently.
  • Creative primitive for reflow: flow typography around moving obstacles (circles, rectangles, or any computed corridor width) using row-by-row streaming layout.
  • Text-as-geometry effects: implement kinetic typography, particle/shatter typography, and shrink-wrapped text “cards” where the layout is driven by measured geometry rather than CSS guessing.

Use Case Example: You want a single-file HTML demo where a long paragraph curves around a dragged orb and stays stable at high frame rates; pretext lets you measure once, then stream layout every frame based on the obstacle’s current position.

Quick Start

Use the pretext skill to generate a single-file HTML demo that measures your chosen real prose with @chenglou/pretext and renders it to a canvas with text flowing around a moving obstacle.

Frequently Asked Questions about pretext

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I flow text around moving obstacles in a browser canvas without DOM reflow?

Text reflow around moving obstacles requires precomputing line breaks and grapheme positions with measurement APIs, then streaming variable-width line layout row-by-row to render interactive typography on a canvas without DOM measurement overhead.

What is kinetic typography and how does precomputed text measurement enable it?

Kinetic typography uses measured geometry to drive text motion and layout effects. By precomputing per-line widths and grapheme positioning from text and font data, you can render particle or shatter typography effects on a canvas at high frame rates.

How do I build a single-file HTML demo with text wrapping around a dragged shape?

To build a single-file HTML demo, you measure your chosen prose with cached prepared handles, then stream the layout every frame based on the obstacle's current position to render text that curves around a dragged orb or shape on a canvas.

Can I render shrink-wrapped text cards that fit precisely in changing geometry using canvas?

Yes, shrink-wrapped text cards are driven by measured geometry rather than CSS guessing. By precomputing line breaks and per-line widths from text, font, and width inputs, you can render text that fits precisely within changing interactive geometry on a canvas.

Does this text layout approach work without CSS or DOM elements for high frame rate rendering?

Yes, the DOM-free text measurement approach precomputes all layout data including line breaks and grapheme positioning, enabling stable high frame rate interactive rendering on a canvas without relying on CSS or DOM reflow.

When should I avoid CSS text wrapping and use precomputed variable-width line layout instead?

You should avoid CSS text wrapping when text must flow around moving obstacles, fit changing geometry precisely, or support kinetic typography effects, as CSS cannot precompute grapheme positions or stream row-by-row layout for interactive canvas rendering.