Skip to content

fix(markdown): reset link-definition continuation when a block quote opens - #10601

Merged
ematipico merged 1 commit into
biomejs:mainfrom
jfmcdowell:fix/md-linkref-quote-list
Jun 10, 2026
Merged

ematipico merged 1 commit into
biomejs:mainfrom
jfmcdowell:fix/md-linkref-quote-list

Conversation

@jfmcdowell

Copy link
Copy Markdown
Contributor

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:

[x]: /url
> 2. q

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 a list_nesting_depth == 0 guard; 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 the link_reference_inside_quote_continuation fixture).

Found by differential fuzzing against commonmark.js.

Test Plan

  • New CST fixtures: fixed case, nested-quote case, and the in-quote continuation negative case; three matching cases added to the differential seed corpus.
  • just test-crate biome_markdown_parser
  • just test-markdown-conformance (652/652)
  • just fuzz-markdown-differential (seed corpus, 154/154)
  • 146k-case generated corpus: 81 fewer mismatches than baseline, no new failures (verified by failure-hash set comparison).

Docs

N/A.

…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.
@changeset-bot

changeset-bot Bot commented Jun 9, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 0624d75

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

✅ Organic activity

No automation signals detected in the analyzed events.

View full analysis →

This is an automated analysis by AgentScan

@github-actions github-actions Bot added A-Parser Area: parser L-Markdown Language: Markdown labels Jun 9, 2026
@codspeed

codspeed Bot commented Jun 9, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 28 untouched benchmarks
⏩ 228 skipped benchmarks1


Comparing jfmcdowell:fix/md-linkref-quote-list (0624d75) with main (8fa36d9)2

Open in CodSpeed

Footnotes

  1. 228 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

  2. No successful run was found on main (741dc89) during the generation of this report, so 8fa36d9 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@jfmcdowell
jfmcdowell marked this pull request as ready for review June 9, 2026 22:29
@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 178f9514-255d-42ab-8ac5-4cb426620fa1

📥 Commits

Reviewing files that changed from the base of the PR and between 8fa36d9 and 0624d75.

⛔ Files ignored due to path filters (3)
  • crates/biome_markdown_parser/tests/md_test_suite/ok/link_reference_inside_quote_continuation.md.snap is excluded by !**/*.snap and included by **
  • crates/biome_markdown_parser/tests/md_test_suite/ok/link_reference_inside_quote_nested_quote_list.md.snap is excluded by !**/*.snap and included by **
  • crates/biome_markdown_parser/tests/md_test_suite/ok/link_reference_then_quoted_ordered_list.md.snap is excluded by !**/*.snap and included by **
📒 Files selected for processing (5)
  • crates/biome_markdown_parser/src/syntax/quote.rs
  • crates/biome_markdown_parser/tests/fuzz_corpus/seed.jsonl
  • crates/biome_markdown_parser/tests/md_test_suite/ok/link_reference_inside_quote_continuation.md
  • crates/biome_markdown_parser/tests/md_test_suite/ok/link_reference_inside_quote_nested_quote_list.md
  • crates/biome_markdown_parser/tests/md_test_suite/ok/link_reference_then_quoted_ordered_list.md

Walkthrough

This PR fixes a Markdown parser bug where the link_reference_definition_continuation state flag was leaking into blockquote content. The fix resets this flag to false when entering a blockquote in parse_quote, ensuring subsequent interrupt checks inside the blockquote start fresh. Supporting test fixtures validate the fix across single blockquotes, nested blockquotes, and ordered-list combinations with link-reference definitions.

Possibly related PRs

  • biomejs/biome#10345: Modifies link_reference_definition_continuation handling around blockquote and ordered-list interactions.
  • biomejs/biome#10192: Defines and clears link_reference_definition_continuation around link-reference-definition continuation logic.
  • biomejs/biome#10199: Changes quote-aware link-reference-definition handling in quote.rs for thematic breaks.

Suggested reviewers

  • dyc3
  • ematipico
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: resetting the link-definition continuation flag when a block quote opens, which is the core fix in this changeset.
Description check ✅ Passed The description clearly explains the bug, the fix mechanism, test coverage, and references the discovery method. It's directly related to the code changes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ematipico
ematipico merged commit fe03ff9 into biomejs:main Jun 10, 2026
32 checks passed
THernandez03 pushed a commit to THernandez03/biome that referenced this pull request Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Parser Area: parser L-Markdown Language: Markdown

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants