pretext
Use when building creative browser demos with @chenglou/pretext — DOM-free text layout for ASCII art, typographic flow around obstacles, text-as-geometry…
Skill by hermesonehq
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/hermesonehq-pretext
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: design, frontend
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/pretext
What's inside
- Skill name
pretext- Description
- Use when building creative browser demos with @chenglou/pretext — DOM-free text layout for ASCII art, typographic flow around obstacles, text-as-geometry games, kinetic typography, and text-powered generative art. Produces single-file HTML demos by default.
- License
- MIT
- Instructions
- 209 lines in SKILL.md · view on GitHub
Files (4)
- SKILL.md
- patterns.md · references/
- donut-orbit.html · templates/
- hello-orb-flow.html · templates/
SKILL.md (first lines)
# Pretext Creative Demos
## Overview
[`@chenglou/pretext`](https://github.com/chenglou/pretext) is a 15KB zero-dependency TypeScript library by Cheng Lou (React core, ReasonML, Midjourney) for **DOM-free multiline text measurement and layout**. It does one thing: given `(text, font, width)`, return the line breaks, per-line widths, per-grapheme positions, and total height — all via canvas measurement, no reflow.
That sounds like plumbing. It is not. Because it is fast and geometric, it is a **creative primitive**: you can reflow paragraphs around a moving sprite at 60fps, build games whose level geometry is made of real words, drive ASCII logos through prose, shatter text into particles with exact per-grapheme starting positions, or pack shrink-wrapped multiline UI without any `getBoundingClientRect` thrash.
This skill exists so Hermes can make **cool demos** with it — the kind people post to X. See `pretext.cool` and `chenglou.me/pretext` for the community demo corpus.
## When to Use
Use when the user asks for:
- A "pretext demo" / "cool pretext thing" / "text-as-X"
- Text flowing around a moving shape (hero sections, editorial layouts, animated long-form pages)
- ASCII-art effects using **real words or prose**, not monospace rasters
- Games where the playfield / obstacles / bricks are made of text (Tetris-from-letters, Breakout-of-prose)
- Kinetic typography with per-glyph physics (shatter, scatter, flock, flow)
- Typographic generative art, especially with non-Latin scripts or mixed scripts
- Multiline "shrink-wrap" UI (smallest container width that still fits the text)
- Anything that would require knowing line breaks *before* rendering
Don't use for:
- Static SVG/HTML pages where CSS already solves layout — just use CSS
- Rich text editors, general inline formatting engines (pretext is intentionally narrow)
- Image → text (use `ascii-art` / `ascii-video` skills)
- Pure canvas generative art with no text role — use `p5js`
## Creative Standard
This is visual art rendered in a browser. Pretext returns numbers; **you** draw the thing.
- **Don't ship a "hello world" demo.** The `hello-orb-flow.html` template is the *starting* point. Every delivered demo must add intentional color, motion, composition, and one visual detail the user didn't ask for but will appreciate.
- **Dark backgrounds, warm cores, considered palette.** Classic amber-on-black (CRT / terminal) works, but so do cold-white-on-charcoal (editorial) and desaturated pastels (risograph). Pick one and commit.
- **Proportional fonts are the point.** Pretext's whole vibe is "not monospaced" — lean into it. Use Iowan Old Style, Inter, JetBrains Mono, Helvetica Neue, or a variable font. Never default sans.
- **Real source/text, not lorem ipsum.** The corpus should mean something. Short manifestos, poetry, real source code, a found text, the library's own README — never `lorem ipsum`.
- **First-paint excellence.** No loading states, no blank frames. The demo must look shippable the instant it opens.
## Stack
Single self-contained HTML file per demo. No build step.
| Layer | Tool | Purpose |
|-------|------|---------|
| Core | `@chenglou/pretext` via `esm.sh` CDN | Text measurement + line layout |
| Render | HTML5 Canvas 2D | Glyph rendering, per-frame composition |
| Segmentation | `Intl.Segmenter` (built-in) | Grapheme splitting for emoji / CJK / combining marks |
| Interaction | Raw DOM events | Mouse / touch / wheel — no framework |
```html
<script type="module">
import {
prepare, layout, // use-case 1: simple height
prepareWithSegments, layoutWithLines, // use-case 2a: fixed-width lines
layoutNextLineRange, materializeLineRange, // use-case 2b: streaming / variable width
measureLineStats, walkLineRanges, // stats without string allocation
} from "https://esm.sh/@chenglou/pretext@0.0.6";
</script>
```
Pin the version. `@0.0.6` at time of writing — check [npm](https://www.npmjs.com/package/@chenglou/pretext) for the latest if demo behavior is off.
## The Two Use Cases
Almost everything reduces to one of these two shapes. Learn both.
### Use-case 1 — measure, then render with CSS/DOM
```js
const prepared = prepare(text, "16px Inter");
const { height, lineCount } = layout(prepared, 320, 20);
```
You still let the browser draw the text. Pretext just tells you how tall the box will be at a given width, **without** a DOM read. Use for:
- Virtualized lists where rows contain wrapping text
- Masonry with precise card heights
- "Does this label fit?" dev-time checks
- Preventing layout shift when remote text loads
**Keep `font` and `letterSpacing` exactly in sync with your CSS.** The canvas `ctx.font` format (e.g. `"16px Inter"`, `"500 17px 'JetBrains Mono'"`) must match the rendered CSS, or measurements drift.
### Use-case 2 — measure *and* render yourself
```js
const prepared = prepareWithSegments(text, FONT);
const { lines } = layoutWithLines(prepared, 320, 26);
for (let i = 0; i < lines.length; i++) {
ctx.fillText(lines[i].text, 0, i * 26);
}
```
This is where the creative work lives. You own the drawing, so you can:
- Render to canvas, SVG, WebGL, or any coordinate system
- Substitute per-glyph transforms (rotation, jitter, scale, opacity)
- Use line metadata (width, grapheme positions) as geometry
For **variable-width-per-line** flow (text around a shape, text in a donut band, text in a non-rectangular column):
```js
let cursor = { segmentIndex: 0, graphemeIndex: 0 };
let y = 0;
while (true) {
const lineWidth = widthAtY(y); // your function: how wide is the corridor at this y?
const range = layoutNextLineRange(prepared, cursor, lineWidth);
if (!range) break;
const line = materializeLineRange(prepared, range);
ctx.fillText(line.text, leftEdgeAtY(y), y);
cursor = range.end;
y += lineHeight;
}
```
This is the most important pattern in the whole library. It's what unlocks "text flowing around a dragged sprite" — the demo that went viral on X.
### Helpers worth knowing
- `measureLineStats(prepared, maxWidth)` → `{ lineCount, maxLineWidth }` — the widest line, i.e. multiline shrink-wrap width.
- `walkLineRanges(prepared, maxWidth, callback)` — iterate lines without allocating strings. Use for stats/physics over graphemes when you don't need the characters.
- `@chenglou/pretext/rich-inline` — the same system but for paragraphs mixing fonts / chips / mentions. Import from the subpath.From hermesonehq/hermes-registry, MIT.
More from hermesonehq/hermes-registry
- 0.588score
google-analytics-data-api-basics
hermesonehq
Manages Google Analytics reporting data, enables the Analytics Data API via the Cloud CLI, and creates reports using the Google Analytics Data API (v1beta).
SkillCFreshness: C★ 92Claude Code +9 - 0.588score
bigquery-ai-ml
hermesonehq
Leverages BigQuery's built-in machine learning and GenAI capabilities for advanced data analytics.
SkillCFreshness: C★ 92Claude Code +9 - 0.585score
alloydb-basics
hermesonehq
Manages clusters, instances, and backups for AlloyDB for PostgreSQL, and integrates with AlloyDB model context protocol (MCP) tools for automated database…
SkillCFreshness: C★ 92Claude Code +9 - 0.583score
oh-my-hermes
hermesonehq
Use when orchestrating multi-agent workflows: deep research, planning with consensus, verified execution, triage, or autopilot.
SkillCFreshness: C★ 92Claude Code +9 - 0.583score
chainlink-agent-skills
hermesonehq
Use when working with Chainlink oracle networks, CCIP cross-chain messaging, or smart contract data feeds.
SkillCFreshness: C★ 92Claude Code +9 - 0.583score
hermes-skill-factory
hermesonehq
Use when you want to auto-generate reusable skills from repeated workflows.
SkillCFreshness: C★ 92Claude Code +9 - 0.579score
baoyu-comic
hermesonehq
Knowledge comics (知识漫画): educational, biography, tutorial.
SkillCFreshness: C★ 92Claude Code +9 - 0.579score
kanban-codex-lane
hermesonehq
Use when a Hermes Kanban worker wants to run Codex CLI as an isolated implementation lane while Hermes keeps ownership of task lifecycle, reconciliation…
SkillCFreshness: C★ 92Claude Code +9 - 0.579score
baoyu-article-illustrator
hermesonehq
Article illustrations: type × style × palette consistency.
SkillCFreshness: C★ 92Claude Code +9 - 0.579score
excalidraw
hermesonehq
Hand-drawn Excalidraw JSON diagrams (arch, flow, seq).
SkillCFreshness: C★ 92Claude Code +9 - 0.579score
baoyu-infographic
hermesonehq
Infographics: 21 layouts x 21 styles (信息图, 可视化).
SkillCFreshness: C★ 92Claude Code +9 - 0.577score
popular-web-designs
hermesonehq
54 real design systems (Stripe, Linear, Vercel) as HTML/CSS.
SkillCFreshness: C★ 92Claude Code +9
Signals
- Stars
- 92
- Forks
- 19
- Open issues
- 1
- Last commit (this folder)
- Jun 2, 2026 (4 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/hermesonehq/hermes-registry
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
Same skill elsewhere
Copies of this SKILL.md published by others; search shows only one of them.
- 0.374score
pretext
m4tinbeigi-official
Use when building creative browser demos with @chenglou/pretext — DOM-free text layout for ASCII art, typographic flow around obstacles, text-as-geometry…
SkillBFreshness: B★ 47Claude Code +9 - 0.331score
pretext
kevinnft
Use when building creative browser demos with @chenglou/pretext — DOM-free text layout for ASCII art, typographic flow around obstacles, text-as-geometry…
SkillCFreshness: C★ 14Claude Code +9 - 0.330score
pretext
werxiao882-cell
Use when building creative browser demos with @chenglou/pretext — DOM-free text layout for ASCII art, typographic flow around obstacles, text-as-geometry…
SkillCFreshness: C★ 13Claude Code +9 - 0.330score
pretext
S3YED
Use when building creative browser demos with @chenglou/pretext — DOM-free text layout for ASCII art, typographic flow around obstacles, text-as-geometry…
SkillCFreshness: C★ 12Claude Code +9 - 0.327score
pretext
AjayRajan05
Use when building creative browser demos with @chenglou/pretext — DOM-free text layout for ASCII art, typographic flow around obstacles, text-as-geometry…
SkillCFreshness: C★ 10Claude Code +9 - 0.327score
pretext
ain3sh
Use when building creative browser demos with @chenglou/pretext — DOM-free text layout for ASCII art, typographic flow around obstacles, text-as-geometry…
SkillCFreshness: C★ 15Claude Code +9 - 0.301score
pretext
zeno-sys
Use when building creative browser demos with @chenglou/pretext — DOM-free text layout for ASCII art, typographic flow around obstacles, text-as-geometry…
SkillCFreshness: C★ 1Claude Code +9 - 0.288score
pretext
kuen0902
Use when building creative browser demos with @chenglou/pretext — DOM-free text layout for ASCII art, typographic flow around obstacles, text-as-geometry…
SkillCFreshness: CClaude Code +9 - 0.288score
pretext
whansel007
Use when building creative browser demos with @chenglou/pretext — DOM-free text layout for ASCII art, typographic flow around obstacles, text-as-geometry…
SkillCFreshness: CClaude Code +9
More from hermesonehq
- 0.588score
bigquery-ai-ml
hermesonehq
Leverages BigQuery's built-in machine learning and GenAI capabilities for advanced data analytics.
SkillCFreshness: C★ 92Claude Code +9 - 0.588score
google-analytics-data-api-basics
hermesonehq
Manages Google Analytics reporting data, enables the Analytics Data API via the Cloud CLI, and creates reports using the Google Analytics Data API (v1beta).
SkillCFreshness: C★ 92Claude Code +9 - 0.585score
alloydb-basics
hermesonehq
Manages clusters, instances, and backups for AlloyDB for PostgreSQL, and integrates with AlloyDB model context protocol (MCP) tools for automated database…
SkillCFreshness: C★ 92Claude Code +9 - 0.583score
oh-my-hermes
hermesonehq
Use when orchestrating multi-agent workflows: deep research, planning with consensus, verified execution, triage, or autopilot.
SkillCFreshness: C★ 92Claude Code +9 - 0.583score
hermes-skill-factory
hermesonehq
Use when you want to auto-generate reusable skills from repeated workflows.
SkillCFreshness: C★ 92Claude Code +9 - 0.583score
chainlink-agent-skills
hermesonehq
Use when working with Chainlink oracle networks, CCIP cross-chain messaging, or smart contract data feeds.
SkillCFreshness: C★ 92Claude Code +9
Cite this page
pretext skill. Agent Mart. https://agentmart.dev/skills/hermesonehq-pretext (last updated 2026-10-24)