The Utility

typeset.ts

The web wasn't built for typographers. By default, browsers allow lonely orphans on the last line of a paragraph, string together clunky rags, leave punctuation awkwardly stranded, and render lists with unrefined spacing.

typeset.ts is a universal typographic enhancement script that fixes all of this dynamically. You drop it into your project, feed it an HTML element, and it applies professional typesetting rules—binding orphans, balancing rags, injecting exact typographic measurements, and bringing structural elegance to your web typography without requiring manual CSS overrides.

01 — The drop-in

One script tag. No configuration, no build step, no framework. It composes paragraphs, list items, and headings with the same engine that sets this site: beam-search line breaking with contour re-ranking, Tschichold spacing, hanging punctuation, smart quotes, and self-checks that fall back to browser rendering rather than ever make your text worse. Opt any element out with data-no-typeset.

go.js — anywhere HTML runs

02 — The library

The same engine as a window.Typeset global, for when you want to decide what gets composed and when.

typeset.min.js — window.Typeset

03 — The source

TypeScript, dependency-free. Both scripts above are generated from this file — what you read here is exactly what runs.

typeset.ts