pretext

Measure multiline text geometry with pretext for DOM-free browser demos.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Pretext turns creative “how should this text layout?” ideas into shippable browser demos by measuring and laying out multiline text without DOM reads or reflow, so you can reliably render text as geometry around moving shapes.

Core Features & Use Cases

  • DOM-free text layout: precompute line breaks and per-grapheme positions from (text, font, width) so you can animate layout without layout shift.
  • Flow around obstacles (variable-width per row): use a streaming layout cursor to route each row around a changing “corridor” shaped by circles, rectangles, sprites, or ASCII masks.
  • Text-as-geometry rendering: use measured per-line and per-grapheme metadata to implement kinetic typography, word-physics, and text-powered generative art in a single-file HTML demo.

Quick Start

Ask the AI to create a single self-contained HTML file using pretext that flows a real paragraph of prose around a draggable orb and includes a warm dark palette plus one extra interactive detail the user didn’t request.

Frequently Asked Questions about pretext

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

FAQPage Schema
How do I measure multiline text geometry for kinetic typography without DOM reads?

DOM-free text layout lets you route text around moving obstacles by using a streaming layout cursor to shape a variable-width corridor for each row, avoiding DOM reflow during animation.

What is the best way to flow a paragraph of text around a moving shape in HTML canvas?

DOM-free text layout lets you route text around moving obstacles by using a streaming layout cursor to shape a variable-width corridor for each row, avoiding DOM reflow during animation.

How do I implement text-as-collision ASCII art demos in a single HTML file?

To build ASCII art and collision demos, generate a self-contained HTML file that uses precomputed line breaks and per-grapheme metadata to drive generative compositions and text physics.

Do I need to pin a specific ESM CDN version to use pretext for text layout?

Yes, you must pin the pretext ESM CDN version and call prepare or prepareWithSegments once per text and font pair before driving layout per row with layoutNextLineRange or layoutWithLines.

Can I animate text reflow around draggable sprites without causing layout shift?

Yes, by precomputing line breaks and per-grapheme positions from text, font, and width, you can animate text reflow around sprites and obstacles without causing layout shift.

Why does my creative coding text layout shift during canvas animation?

Text layout shifts during canvas animation when relying on DOM reads; precomputing multiline text geometry without DOM reflow ensures stable per-grapheme positions for kinetic typography.