Caveats and limits
Pretext targets common web defaults—not a full typesetting engine. Align with your target browsers and designs.
Match your CSS
The font string passed to prepare should match the rendered CSS font (size, weight, style, family). lineHeight should match CSS line-height for pixel-accurate comparisons.
Default behavior
The library broadly targets stacks like (see upstream for exact guarantees):
- white-space: normal (or pre-wrap when that mode is enabled)
- word-break: normal
- overflow-wrap: break-word
- line-break: auto
Very narrow boxes may still break inside words at grapheme boundaries, similar to break-word.
pre-wrap mode
With { whiteSpace: 'pre-wrap' }, spaces, tabs, and newlines are preserved; tabs follow an 8-column stop model like common browsers.
Font family names
On macOS, using system-ui alone for measurement can be unreliable; prefer explicit family names.
Demos on this site
Demos use a generic sans-serif stack. For production parity, set DEMO_FONT in code to match your product font declaration.