본문으로 건너뛰기
Skillpedia
웹사이트 및 UI (프런트엔드)260k · #474

pretext

하는 일

텍스트가 주된 시각 요소인 창의적 브라우저 데모를 만드는 것을 돕습니다. 예를 들면 움직이는 스프라이트 주위로 흐르는 문단이 있습니다. 독특하고 눈길을 끄는 웹 효과를 원하는 개발자와 디자이너를 위한 것입니다.

사용하는 경우

  • ✓텍스트가 움직이는 도형이나 애니메이션 요소 주위를 흐르게 하고 싶을 때.
  • ✓실제 단어로 만든 게임이나 ASCII 스타일 효과를 원할 때.
  • ✓텍스트를 입자로 쪼개는 키네틱 타이포그래피를 원할 때.

스킬 링크

https://github.com/NousResearch/hermes-agent/blob/main/optional-skills/creative/pretext/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/NousResearch/hermes-agent/blob/main/optional-skills/creative/pretext/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“튕기는 공 주위로 문단이 다시 흐르는 브라우저 데모를 만들어 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 pretext 라이브러리로 브라우저의 일반 레이아웃 단계 없이 텍스트를 측정하고 배치하므로, 프레임마다 위치를 빠르게 갱신할 수 있습니다. 그 배치를 바탕으로 시각 효과를 만듭니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Pretext Creative Demos

Overview

@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
<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 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

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 he
자주 묻는 질문

pretext 라이브러리는 무엇인가요?

페이지 레이아웃을 건드리지 않고 여러 줄 텍스트를 측정하고 배치하는 작은 TypeScript 라이브러리입니다.

실제 운영 웹사이트용인가요?

스킬은 일상적인 페이지 레이아웃보다는 온라인에서 공유하는 창의적 데모를 목표로 합니다.

라이브러리는 얼마나 큰가요?

스킬은 의존성 없이 약 15KB라고 설명합니다.

상세 정보

작성자의 원본 설명

Build creative browser demos with DOM-free text layout.

repo: NousResearch/hermes-agent

인기도

GitHub 스타
260k
순위
#474
라이선스
MIT
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬