Skip to content

fix(emphasis): hard-break sentinel breaks punctuation-closed bold#238

Merged
jonathanKingston merged 1 commit into
mainfrom
jkt/auto/sentinel-hard-break-bold-87bb
Jul 23, 2026
Merged

fix(emphasis): hard-break sentinel breaks punctuation-closed bold#238
jonathanKingston merged 1 commit into
mainfrom
jkt/auto/sentinel-hard-break-bold-87bb

Conversation

@jonathanKingston

Copy link
Copy Markdown
Collaborator

Summary

Hard breaks are replaced with a \uFFFE sentinel before emphasis runs so newlines aren’t flattened away. That sentinel was neither whitespace nor punctuation for CommonMark flanking checks, so a closer after punctuation (?** / !** / .** + hard break) failed right-flanking and left the markers literal.

What Copse does now
Is pulling it possible?

…would bold the first line and leave ** on the second. Soft breaks and same-line closers were unaffected.

Fix

Treat the hard-break sentinel as flanking whitespace in isFlankingWhitespace (a hard break stands in for a newline). This also fixes the same pattern for * emphasis and GFM ~~ strikethrough, which share the flanking helpers.

Test plan

  • Regression coverage in renderer.test.ts for punctuation-closed strong/em/strike before two-space and backslash hard breaks
  • Focused tests: renderer.test.ts, inline-emphasis.test.ts, inline-strikethrough.test.ts
  • CI / full suite on the PR
Open in Web Open in Cursor 

Punctuation-closed `**`/`*`/`~~` before a hard break failed CommonMark
right-flanking because the `\uFFFE` sentinel is neither whitespace nor
punctuation, so closers stayed literal. Count the sentinel as whitespace.

Co-authored-by: Jonathan Kingston <jonathanKingston@users.noreply.github.com>
@jonathanKingston
jonathanKingston marked this pull request as ready for review July 23, 2026 17:54
@jonathanKingston
jonathanKingston merged commit 5107a13 into main Jul 23, 2026
6 checks passed
@jonathanKingston
jonathanKingston deleted the jkt/auto/sentinel-hard-break-bold-87bb branch July 23, 2026 17:55
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.

2 participants