pretext

Measure multiline text and compute line breaks with pretext for DOM-free browser demos.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and assets (resource) components.

What problem does it solve?

It solves the problem of building creative, typographic browser demos that need accurate text measurement and reflow without relying on DOM layout tricks or layout-shift-prone workarounds.

Core Features & Use Cases

  • DOM-free text layout: measure multiline text, line breaks, per-grapheme positions, and heights using pretext instead of expensive DOM reads.
  • Text flowing around obstacles: route text row-by-row around moving shapes (dragged sprites, orbits, editorial pull-quote spaces).
  • Text-as-geometry generative effects: build kinetic typography and games where level geometry is made of measured text.
  • Single-file HTML demos: produces lightweight, shippable demos that run directly in the browser by rendering your own canvas/SVG/WebGL from pretext’s measurements.

Use case example: A user wants a “cool pretext thing” where a paragraph flows around a moving orb—pretext provides the per-row corridor widths so you can draw the text with the right wrapping behavior in real time.

Quick Start

Use the pretext skill to generate a single-file HTML demo that flows a real paragraph around a moving obstacle using pretext’s layoutNextLineRange pattern.

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 and compute line breaks in a browser canvas without using the DOM?

You can measure multiline text without the DOM by computing line breaks, widths, and per-grapheme positions directly using a layout engine. This approach avoids expensive DOM reads and provides accurate text measurement for canvas or SVG rendering.

What is the best way to make text flow around moving obstacles in an HTML canvas animation?

To flow text around moving obstacles in a canvas animation, calculate per-row corridor widths and apply a layout loop using a portable cursor. This dynamically adjusts text wrapping in real time for kinetic typography and interactive web demos without relying on DOM reflow hacks.

Can I build generative ASCII art and kinetic typography games that run entirely in a single-file HTML demo?

Yes, you can build generative ASCII art and kinetic typography games in a single-file HTML demo by measuring text as geometry and rendering it directly through canvas, SVG, or WebGL. This produces lightweight browser demos that bypass DOM layout dependencies entirely.

Does DOM-free text layout require an external runtime import to function correctly?

Yes, DOM-free text layout requires an external runtime import with a pinned version to function correctly. You must match a canvas or CSS font string and implement a layout loop using prepareWithSegments and layoutNextLineRange with a portable cursor for accurate visual output.

Why does my canvas text wrapping not working with variable-width corridors need a portable cursor?

Canvas text wrapping fails with variable-width corridors when the layout loop lacks a portable cursor to track position accurately. Using prepareWithSegments alongside layoutNextLineRange ensures the text reflow respects dynamic corridor boundaries and maintains correct per-grapheme positioning across moving obstacles.