Skip to content

Spec 001 T030 follow-up: hyphenated names kept whole - #166

Merged
adamjohnwright merged 2 commits into
mainfrom
layout/hyphen-breaks
Nov 4, 2026
Merged

adamjohnwright merged 2 commits into
mainfrom
layout/hyphen-breaks

Conversation

@adamjohnwright

Copy link
Copy Markdown
Contributor

Spec 001, a follow-up to T030, from #164's review.

  • Hyphenated names are kept whole: a token is now measured by its longest run between places Chromium breaks a line, and breaks go only inside a run over 40. Chromium breaks after -, U+2010, a soft hyphen, U+058A, U+2012, U+2013, U+2027, U+2E17, U+30FB and ?, before U+1806, and on both sides of an em dash; not at U+2011, U+2015, U+2212, / or |, all measured by ci/measure/breaks.ts, which fails if the code disagrees. 1-phosphatidyl-1D-myo-inositol-4,5-bisphosphate was broken into "1D" and "4,5"; it now prints whole.
  • U+2011: FR-017 substitutes it with - before the layout, so it breaks in print as any hyphen does (recorded).
  • NEL (U+0085) breaks; a space with a combining mark ends a token; comments and notes corrected (numeric references are dead code after the sanitiser).

Tests: test/layout/html.test.ts (14); 455 in all. Mutants in tasks.md.

🤖 Generated with Claude Code

adamjohnwright and others added 2 commits November 4, 2026 04:35
A long token is now measured by its longest run between places Chromium
breaks a line, so a hyphenated chemical name is no longer given a <wbr>
mid-run. ci/measure/breaks.ts measures ASCII punctuation, hyphens and
dashes between letters and digits, and checks breakBeside against it:
Chromium breaks after -, U+2010, U+00AD, U+058A, U+2012, U+2013, U+2027,
U+2E17, U+30FB and ?, before U+1806, and both sides of U+2014. U+2011
reaches the layout as - (FR-017 runs first), and is counted as the break
Chromium makes after it in print.

U+0085 is measured as a break and added to the spaces. A space with a
combining mark ends a token as the space does; a hyphen with one is
taken to join. The spaces comment names the en and em spaces rightly,
and the numeric-reference branch is said to be defensive.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@adamjohnwright
adamjohnwright merged commit d2cbcc3 into main Nov 4, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant