fix(markdown_parser): parse quoted ordered list interrupts#10194
Conversation
|
Merging this PR will not alter performance
Comparing Footnotes
|
WalkthroughThis 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
🚥 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. Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
crates/biome_markdown_parser/src/syntax/list.rs (1)
2345-2358: ⚡ Quick winAdd 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
⛔ Files ignored due to path filters (1)
crates/biome_markdown_parser/tests/md_test_suite/ok/block_quote_ordered_list_interrupt.md.snapis excluded by!**/*.snapand included by**
📒 Files selected for processing (3)
crates/biome_markdown_parser/src/syntax/list.rscrates/biome_markdown_parser/tests/md_test_suite/ok/block_quote_ordered_list_interrupt.htmlcrates/biome_markdown_parser/tests/md_test_suite/ok/block_quote_ordered_list_interrupt.md
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_parserjust test-markdown-conformancejust fuzz-markdown-differentialThe 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