Skip to content

fix(markdown_parser): parse quoted ordered list interrupts#10194

Merged
dyc3 merged 1 commit into
biomejs:mainfrom
jfmcdowell:md-blockquote-ordered-list-interrupt
May 1, 2026
Merged

fix(markdown_parser): parse quoted ordered list interrupts#10194
dyc3 merged 1 commit into
biomejs:mainfrom
jfmcdowell:md-blockquote-ordered-list-interrupt

Conversation

@jfmcdowell
Copy link
Copy Markdown
Contributor

@jfmcdowell jfmcdowell commented May 1, 2026

Note

I used Codex to help investigate the fuzz mismatch and validate the fix.

Summary

Fixes a markdown parser edge case where an ordered list marker inside a block quote could remain lazy paragraph text in the previous bullet list item.

The parser now recognizes textual ordered markers after quote-prefix handling during list continuation, allowing the quoted ordered list to start as its own list.

Test Plan

Added a regression test covering the fuzz-discovered blockquote list-interruption case where a following ordered marker was incorrectly parsed as part of the previous bullet item.

  • just test-crate biome_markdown_parser
  • just test-markdown-conformance
  • just fuzz-markdown-differential

The differential fuzzer was used to discover the original mismatch against commonmark.js. The checked-in regression now verifies the fixed case directly.

Docs

N/A

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 1, 2026

⚠️ No Changeset found

Latest commit: ee5f7f7

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 added A-Parser Area: parser L-Markdown Language: Markdown labels May 1, 2026
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 1, 2026

Merging this PR will not alter performance

✅ 28 untouched benchmarks
⏩ 228 skipped benchmarks1


Comparing jfmcdowell:md-blockquote-ordered-list-interrupt (ee5f7f7) with main (46393e0)

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.

@jfmcdowell jfmcdowell marked this pull request as ready for review May 1, 2026 21:36
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 1, 2026

Walkthrough

This PR introduces ordered-list-item lookahead detection to the Markdown parser that recognises ordered list markers when lexed as textual content and validates them against indentation constraints. The lookahead is integrated into list-item continuation logic to prevent lazy continuation when textual ordered markers are present, trigger re-lexing and parsing on sufficient indentation, and treat textual ordered markers as block interrupts when indentation is insufficient. Two test fixtures validate the parsing behaviour in block quotes with mixed list markup.

Possibly related PRs

Suggested reviewers

  • dyc3
  • ematipico
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the main change: fixing ordered list interrupts within block quotes in the markdown parser.
Description check ✅ Passed The description clearly explains the edge case being fixed, the solution approach, and provides comprehensive testing details that align with the changeset.
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
Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.

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

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
crates/biome_markdown_parser/src/syntax/list.rs (1)

2345-2358: ⚡ Quick win

Add one fixture for the sufficient-indent textual parse path

Line 2345 adds a distinct forced re-lex parse branch; the new regression case appears to exercise the interrupt path. Please add one case where quoted textual 1. is sufficiently indented and must parse as an ordered sublist, so both branches are locked down.

As per coding guidelines "All code changes MUST include appropriate tests: ... parsers require test files covering valid and error cases, and bug fixes require tests that reproduce and validate the fix."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/biome_markdown_parser/src/syntax/list.rs` around lines 2345 - 2358,
The new forced re-lex branch for textual ordered items (the
at_order_list_item_textual_with_base_indent ->
p.set_force_ordered_list_marker(true) -> p.force_relex_regular() ->
parse_order_list_item code path) needs a regression test: add a parser fixture
that includes a quoted textual line containing "1." with sufficient indentation
to be treated as an ordered sublist (i.e., a quoted block where the numeric
marker is indented past the base list item indent) so the code exercises the
forced re-lex path and validates it parses as a nested ordered list; create the
test file alongside existing parser fixtures, assert the parse result matches an
ordered sublist structure (use the same test harness/assert style as nearby
tests) to cover this branch and prevent regressions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@crates/biome_markdown_parser/src/syntax/list.rs`:
- Around line 2345-2358: The new forced re-lex branch for textual ordered items
(the at_order_list_item_textual_with_base_indent ->
p.set_force_ordered_list_marker(true) -> p.force_relex_regular() ->
parse_order_list_item code path) needs a regression test: add a parser fixture
that includes a quoted textual line containing "1." with sufficient indentation
to be treated as an ordered sublist (i.e., a quoted block where the numeric
marker is indented past the base list item indent) so the code exercises the
forced re-lex path and validates it parses as a nested ordered list; create the
test file alongside existing parser fixtures, assert the parse result matches an
ordered sublist structure (use the same test harness/assert style as nearby
tests) to cover this branch and prevent regressions.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 2c272ea6-c1d8-475d-b68b-a5675bf77e4e

📥 Commits

Reviewing files that changed from the base of the PR and between 46393e0 and ee5f7f7.

⛔ Files ignored due to path filters (1)
  • crates/biome_markdown_parser/tests/md_test_suite/ok/block_quote_ordered_list_interrupt.md.snap is excluded by !**/*.snap and included by **
📒 Files selected for processing (3)
  • crates/biome_markdown_parser/src/syntax/list.rs
  • crates/biome_markdown_parser/tests/md_test_suite/ok/block_quote_ordered_list_interrupt.html
  • crates/biome_markdown_parser/tests/md_test_suite/ok/block_quote_ordered_list_interrupt.md

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