Skip to content

Latest commit

 

History

568 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

typeset.us

Better line breaks for web text. Typeset keeps short words like "a", "the" and "of" from being stranded at line ends, keeps names and numbers with their words, and avoids one-word last lines, in Chrome, Safari and Firefox alike. It leaves links, emphasis and React-rendered text exactly as authored, checks every result after rendering, and keeps the browser's layout whenever it cannot do better. The engine sets every page of typeset.us; the argument is at typeset.us/essay.

Use CSS first: text-wrap: balance for headlines, text-wrap: pretty for paragraphs. Add Typeset for grammar-aware breaks, the same result in Firefox (which has no pretty), preserved markup, and results your CI can check. It does not hyphenate or justify.

Install

The current release, pinned with its integrity hash:

<script src="https://typeset.us/go@4.4.0.js" integrity="sha384-OPixflfJwk7LTcwv7u1n3T6ratxF6EeTJXn3D/TnLw9bCV2qkIVogco3QFZj6l5D" crossorigin="anonymous" defer></script>
npm i -E typeset.us@4.4.0

Published pins are permanent: their bytes never change and they are never removed. Every pin and its hash is in public/sri.json. https://typeset.us/go.js also works for trying it out; it updates itself within 4.x and will never move to 5.0. What a version number promises: STABILITY.md.

The package README covers options, outcomes, React, costs and limits: packages/typeset-v4/README.md.

Verification, not vibes

auditJSON(selector) reports errors, items to review, and what happened to every element. A pass requires a nonempty scope with no hard errors or unprocessed targets; it is not aesthetic certification. Every outcome is explained in docs/outcomes.md. Full contract for agents: typeset.us/for-agents. Read support, including what is not yet tested, and migration.

This repository

Develop

npm run dev           # site at localhost:3000
npm run build:dist    # candidate build from src into output/candidate/; never writes packages/ or public/
npm test              # test:v4: builds the candidate, then runs every suite against it (--only, --list)
npm run test:release  # the same suites against the committed packages/typeset-v4/dist
npm run bench         # benchmark: mount, typesetAll, React, storms, fonts, sizes (docs/BENCHMARKS.md)
npm run release:cut -- --version x.y.z --summary "…"  # the only step that writes a release (try --dry-run)

How to contribute, and how to report a bad line break: CONTRIBUTING.md. Releases: docs/RELEASING.md. Security: SECURITY.md.

MIT © Dustin York. The line-break data is Unicode, Inc. (Unicode-3.0).

About

Browser paragraph compositor: beam-search line breaking that verifies its own output. audit() returns [] — or it restores the browser's layout.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages