fix(markdown) don't treat a thematic break as the start of bold text - #4485
Merged
Conversation
joshgoebel
approved these changes
Aug 10, 2026
Build Size ReportChanges to minified artifacts in 5 files changedTotal change +26 B View Changes
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3719. Picks up where #3909 left off, addressing @joshgoebel's review comments there.
***on its own line is a thematic break, butBOLDwas tried beforeHORIZONTAL_RULEin the top-levelcontains, so it matched**and opened astrongspan that swallowed the rest of the document.Simply reordering was what stalled the previous attempt, because the old matcher (
^[-\*]{3,}…$) was loose enough to also eat the opening***of***bold italic***. So this does both: anchors the rule to a full line, then moves it ahead ofBOLD/ITALIC.Per spec 0.31.2: up to three leading spaces, then the same marker three or more times, separated and followed by spaces or tabs, and nothing else on the line.
On the earlier review comments:
_style rule — covered; the marker is a capture group with a backreference, so___works and mixed runs like-*-correctly don't.\s*$— deliberately not used:\smatches\n, which would let a break swallow following blank lines.[ \t]*matches the spec's wording.*inside[]— not needed, dropped.Behaviour is unchanged for
***bold italic***,**bold**,*italic*, setext headings (Heading/---), and list bullets — all covered by the existingbold_italicsandlisttests, which still pass.Out of scope, flagging it so it isn't a surprise:
- - -still highlights as a bullet becauseLISTprecedesHORIZONTAL_RULE. The spec says a thematic break wins there, but that's a separate precedence question and I'd rather not fold it into this fix. Happy to follow up.npx mocha test→ 1611 passing, 3 pending (was 1610 before the new test). Lint onsrc/languages/markdown.jsis unchanged frommain(one pre-existingspaced-commenterror on theENTITYcomment, untouched here).Checklist
test/markup/markdown/horizontal_rule.{txt,expect.txt})CHANGES.md