Repository navigation
fix(markdown): reset link-definition continuation when a block quote opens - #10601
Conversation
…opens
A link reference definition with no trailing blank line sets
`link_reference_definition_continuation` so that the next line is treated
as paragraph continuation per CommonMark, where an ordered list starting
at a number other than 1 cannot interrupt (§5.2). The flag was only
cleared after the *next sibling block* completed, so it leaked into the
content of a block quote that immediately followed the definition:
[x]: /url
> 2. q
parsed the quoted line as a paragraph instead of `<ol start="2">`. A `>`
marker interrupts a paragraph (§5.1), so the continuation cannot extend
into the quote. Reset the flag on quote entry; a definition inside the
quote sets it again, so in-quote continuation behavior is unchanged.
Found by differential fuzzing against commonmark.js.
|
✅ Organic activityNo automation signals detected in the analyzed events. This is an automated analysis by AgentScan |
Merging this PR will not alter performance
Comparing Footnotes
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (3)
📒 Files selected for processing (5)
WalkthroughThis PR fixes a Markdown parser bug where the Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Note
I used Claude to help investigate, implement, and validate this fix.
Summary
A link reference definition with no trailing blank line sets
link_reference_definition_continuation, so the next line is treated as paragraph continuation (an ordered list starting at a number other than 1 cannot interrupt a paragraph, CommonMark §5.2). The flag was only cleared after the next sibling block completed, so it leaked into the content of a block quote that immediately followed the definition:was parsed as a quoted paragraph instead of
<ol start="2">. The same leak affected lists nested in a second quote level. List content was already protected by alist_nesting_depth == 0guard; quote content had no equivalent.A
>marker interrupts a paragraph (§5.1), so the continuation cannot extend into the quote. The fix resets the flag on quote entry. A definition inside the quote sets the flag again after that point, so in-quote continuation behavior is unchanged (covered by thelink_reference_inside_quote_continuationfixture).Found by differential fuzzing against commonmark.js.
Test Plan
just test-crate biome_markdown_parserjust test-markdown-conformance(652/652)just fuzz-markdown-differential(seed corpus, 154/154)Docs
N/A.