pretext

Frameworks & Libraries

Fast, accurate and comprehensive text measurement and layout.

Latest v0.0.9 · by chenglouWebsiteRSS

Release activity

Release activity — 6 releases across 6 days since Apr 1, 2026. Each cell is one day; darker means more releases that day. Nothing is recorded before Apr 1, 2026. Older weeks are hidden at this screen width.
JunJulAugSep
SundayNo releases on May 31, 2026No releases on Jun 7, 2026No releases on Jun 14, 2026No releases on Jun 21, 2026No releases on Jun 28, 2026No releases on Jul 5, 2026No releases on Jul 12, 2026No releases on Jul 19, 2026No releases on Jul 26, 2026No releases on Aug 2, 2026No releases on Aug 9, 2026No releases on Aug 16, 2026No releases on Aug 23, 2026No releases on Aug 30, 2026No releases on Sep 6, 2026No releases on Sep 13, 2026
MondayNo releases on Jun 1, 2026No releases on Jun 8, 2026No releases on Jun 15, 2026No releases on Jun 22, 2026No releases on Jun 29, 2026No releases on Jul 6, 2026No releases on Jul 13, 2026No releases on Jul 20, 2026No releases on Jul 27, 2026No releases on Aug 3, 2026No releases on Aug 10, 2026No releases on Aug 17, 2026No releases on Aug 24, 2026No releases on Aug 31, 20261 release on Sep 7, 2026No releases on Sep 14, 2026
TuesdayNo releases on Jun 2, 2026No releases on Jun 9, 2026No releases on Jun 16, 2026No releases on Jun 23, 2026No releases on Jun 30, 2026No releases on Jul 7, 2026No releases on Jul 14, 2026No releases on Jul 21, 2026No releases on Jul 28, 2026No releases on Aug 4, 2026No releases on Aug 11, 2026No releases on Aug 18, 2026No releases on Aug 25, 2026No releases on Sep 1, 2026No releases on Sep 8, 2026
WednesdayNo releases on Jun 3, 2026No releases on Jun 10, 2026No releases on Jun 17, 2026No releases on Jun 24, 2026No releases on Jul 1, 2026No releases on Jul 8, 2026No releases on Jul 15, 2026No releases on Jul 22, 2026No releases on Jul 29, 2026No releases on Aug 5, 2026No releases on Aug 12, 2026No releases on Aug 19, 2026No releases on Aug 26, 2026No releases on Sep 2, 2026No releases on Sep 9, 2026
ThursdayNo releases on Jun 4, 2026No releases on Jun 11, 2026No releases on Jun 18, 2026No releases on Jun 25, 2026No releases on Jul 2, 2026No releases on Jul 9, 2026No releases on Jul 16, 2026No releases on Jul 23, 2026No releases on Jul 30, 2026No releases on Aug 6, 2026No releases on Aug 13, 2026No releases on Aug 20, 2026No releases on Aug 27, 2026No releases on Sep 3, 2026No releases on Sep 10, 2026
FridayNo releases on Jun 5, 20261 release on Jun 12, 2026No releases on Jun 19, 2026No releases on Jun 26, 2026No releases on Jul 3, 2026No releases on Jul 10, 2026No releases on Jul 17, 2026No releases on Jul 24, 2026No releases on Jul 31, 2026No releases on Aug 7, 2026No releases on Aug 14, 2026No releases on Aug 21, 2026No releases on Aug 28, 2026No releases on Sep 4, 2026No releases on Sep 11, 2026
SaturdayNo releases on Jun 6, 2026No releases on Jun 13, 2026No releases on Jun 20, 2026No releases on Jun 27, 2026No releases on Jul 4, 2026No releases on Jul 11, 2026No releases on Jul 18, 2026No releases on Jul 25, 2026No releases on Aug 1, 2026No releases on Aug 8, 2026No releases on Aug 15, 2026No releases on Aug 22, 2026No releases on Aug 29, 2026No releases on Sep 5, 2026No releases on Sep 12, 2026

6 releases since Apr 1, 2026

Changelog

v0.0.9

Latest
Fixed 8
  • Streaming line layouts and line statistics now agree with batch layout when a later break follows a soft hyphen, and streaming retains later text after consecutive lines containing only invisible break controls
  • Terminal soft hyphens now stay invisible and preserve terminal letter spacing across the rich line APIs
  • Rich bidi metadata now resets independently at each paragraph boundary
  • Rich-inline preparation with long internal whitespace, streaming layout of long hyphenated runs, and long font-size strings now avoid excessive repeated work
  • Rich-inline cursors now retain original item indices across empty items, zero-width items can occupy a line, and boundary spaces preserve their font and signed letter spacing, and mutating a visited line no longer changes the walker's continuation
  • Overlong independent symbol runs can now wrap at grapheme boundaries with browser-specific punctuation attachment
  • Numeric minus signs no longer introduce a preferred break before their number, and ASCII hyphens after CJK text stay attached to the preceding character
  • The Markdown chat demo now keeps ordinary text inside its bubbles in Firefox on macOS

From pretext

Fixed
  • Streaming line layouts and line statistics now agree with batch layout when a later break follows a soft hyphen. Streaming also retains later text after consecutive lines containing only invisible break controls (#222).
  • Terminal soft hyphens now stay invisible and preserve terminal letter spacing across the rich line APIs.
  • Rich bidi metadata now resets independently at each paragraph boundary.
  • Rich-inline preparation with long internal whitespace, streaming layout of long hyphenated runs, and long font-size strings now avoid excessive repeated work (#221).
  • Rich-inline cursors now retain original item indices across empty items, zero-width items can occupy a line, and boundary spaces preserve their font and signed letter spacing. Mutating a visited line no longer changes the walker's continuation (#220).
  • Overlong independent symbol runs can now wrap at grapheme boundaries, with browser-specific punctuation attachment (#208).
  • Numeric minus signs no longer introduce a preferred break before their number, and ASCII hyphens after CJK text stay attached to the preceding character (#213, #215).
  • The Markdown chat demo now keeps ordinary text inside its bubbles in Firefox on macOS (#202).
View originalPermalink
How v0.0.9 went
v0.0.8

v0.0.8: Release 0.0.8

Added 1
  • The published package now ships declaration maps for editor go-to-definition and programmatic TypeScript source tracing to land in the shipped .ts source instead of .d.ts files
Fixed 2
  • Word-internal keyboard and Unicode symbol runs in long words now stay with surrounding text the way browsers break them, while browser-break symbols stay breakable
  • Overlong hyphenated runs now prefer browser-like dash breakpoints before falling back to emergency grapheme breaks

From pretext

Added
  • The published package now ships declaration maps, so editor go-to-definition and programmatic TypeScript source tracing land in the shipped .ts source instead of the .d.ts files.
Fixed
  • Word-internal keyboard and Unicode symbol runs in long words now stay with surrounding text the way browsers break them, while browser-break symbols stay breakable (#169).
  • Overlong hyphenated runs now prefer browser-like dash breakpoints before falling back to emergency grapheme breaks (#89).
View originalPermalink
How v0.0.8 went

v0.0.7

Changed 2
  • The package now declares itself side-effect-free so bundlers can tree-shake unused entrypoints
  • layoutNextLine() and layoutNextLineRange() now avoid redundant chunk lookup in chunk-heavy manual layout paths
Fixed 8
  • { wordBreak: 'keep-all' } now handles no-space mixed Latin, numeric, and CJK text more like browsers
  • No-space punctuation chains now stay together for non-ASCII word-like text too, instead of only ASCII words
  • Opening punctuation such as ¡, ¿, German low quotes, and ⸘ now stays with the following word instead of dangling at line end
  • Numeric prefix/postfix symbols like $, %, €, +, −, and ° now stay attached to adjacent text the way browser line breaking does
  • Soft-hyphen breaks now stay at the soft-hyphen insertion point instead of pulling post-hyphen graphemes onto the broken line
  • Line geometry now preserves browser-style terminal letter spacing, including rich-inline item boundaries and visible soft-hyphen breaks
  • Rich-inline item boundaries no longer overflow the requested width after a forced-progress break
  • The markdown chat demo now drops parsed link URLs unless they resolve to HTTP(S) hrefs

From pretext

Changed
  • The package now declares itself side-effect-free so bundlers can tree-shake unused entrypoints (#160).
  • layoutNextLine() and layoutNextLineRange() now avoid redundant chunk lookup in chunk-heavy manual layout paths (#140).
Fixed
  • { wordBreak: 'keep-all' } now handles no-space mixed Latin, numeric, and CJK text more like browsers.
  • No-space punctuation chains now stay together for non-ASCII word-like text too, instead of only ASCII words.
  • Opening punctuation such as ¡, ¿, German low quotes, and now stays with the following word instead of dangling at line end (#165).
  • Numeric prefix/postfix symbols like $, %, , +, , and ° now stay attached to adjacent text the way browser line breaking does (#105).
  • Soft-hyphen breaks now stay at the soft-hyphen insertion point instead of pulling post-hyphen graphemes onto the broken line (#162).
  • Line geometry now preserves browser-style terminal letter spacing, including rich-inline item boundaries and visible soft-hyphen breaks (#171).
  • Rich-inline item boundaries no longer overflow the requested width after a forced-progress break (#132).
  • The markdown chat demo now drops parsed link URLs unless they resolve to HTTP(S) hrefs (#168).
View originalPermalink
How v0.0.7 went

v0.0.6

Added 1
  • Numeric CSS-pixel letterSpacing support on prepare(), prepareWithSegments(), and each existing rich-inline item
Fixed 1
  • CJK text followed by opening bracket annotations now wraps like browsers instead of leaving the opening bracket on the previous line

From pretext

Added
  • Numeric CSS-pixel letterSpacing support on prepare(), prepareWithSegments(), and each existing rich-inline item (#108, #156).
Fixed
  • CJK text followed by opening bracket annotations now wraps like browsers instead of leaving the opening bracket on the previous line (#148).
View originalPermalink
How v0.0.6 went

v0.0.5

Added 4
  • Add geometry-first rich line helpers for manual layout work: measureLineStats(), measureNaturalWidth(), layoutNextLineRange(), and materializeLineRange()
  • Add @chenglou/pretext/rich-inline, a narrow helper for inline-only rich text, mentions/chips, and browser-like boundary whitespace collapse
  • Add { wordBreak: 'keep-all' } support on prepare() / prepareWithSegments() for CJK and Hangul text
  • Add a virtualized markdown chat demo for rich inline text and pre-wrap layout
Changed 1
  • Make prepare-time analysis more resilient on long mixed-script, CJK, Arabic, repeated-punctuation, and other degenerate inputs
Fixed 2
  • Fix mixed CJK-plus-numeric runs, keep-all mixed-script boundaries, and long breakable runs to stay closer to browser behavior
  • Fix rich-path bidi metadata and CJK detection to handle the relevant astral Unicode ranges correctly

From pretext

Added
  • Geometry-first rich line helpers for manual layout work: measureLineStats(), measureNaturalWidth(), layoutNextLineRange(), and materializeLineRange().
  • @chenglou/pretext/rich-inline, a narrow helper for inline-only rich text, mentions/chips, and browser-like boundary whitespace collapse.
  • { wordBreak: 'keep-all' } support on prepare() / prepareWithSegments() for CJK and Hangul text.
  • A virtualized markdown chat demo for rich inline text and pre-wrap layout.
Changed
  • Prepare-time analysis is more resilient on long mixed-script, CJK, Arabic, repeated-punctuation, and other degenerate inputs.
Fixed
  • Mixed CJK-plus-numeric runs, keep-all mixed-script boundaries, and long breakable runs now stay closer to browser behavior.
  • Rich-path bidi metadata and CJK detection now handle the relevant astral Unicode ranges correctly.
View originalPermalink
How v0.0.5 went

v0.0.4

Added 1
  • A justification comparison demo that shows native CSS justification, greedy hyphenation, and a Knuth-Plass-style paragraph layout side by side
Changed 1
  • Rich layout is faster on chunk-heavy and long-breakable text
Fixed 2
  • layout(), layoutWithLines(), and layoutNextLine() stay aligned on narrow ZWSP / grapheme-breaking edge cases
  • The justification comparison demo no longer paints justified lines wider than their column

From pretext

Added
  • A justification comparison demo that shows native CSS justification, greedy hyphenation, and a Knuth-Plass-style paragraph layout side by side.
Changed
  • Rich layout is faster on chunk-heavy and long-breakable text.
Fixed
  • layout(), layoutWithLines(), and layoutNextLine() stay aligned on narrow ZWSP / grapheme-breaking edge cases.
  • The justification comparison demo no longer paints justified lines wider than their column.
View originalPermalink
How v0.0.4 went
View all

Discussion