fix(markdown_parser): handle ordered sublist continuation#10349
fix(markdown_parser): handle ordered sublist continuation#10349jfmcdowell wants to merge 2 commits into
Conversation
|
Merging this PR will not alter performance
Comparing Footnotes
|
8981d5d to
5067f94
Compare
5067f94 to
276d85d
Compare
|
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThis PR refines the Markdown parser's handling of ordered-list markers to comply with CommonMark §5.2 rules: ordered list markers must start with "1" and be non-empty to interrupt paragraph lazy continuation. The core logic moves from 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
crates/biome_markdown_parser/src/syntax/list.rs (1)
2626-2674: ⚡ Quick winConsider adding a comment for the
force_paragraph_continuationlogic.The condition at lines 2640–2647 is subtle and implements a key CommonMark §5.2 rule: ordered markers that don't start with
1cannot interrupt paragraph continuation. A brief comment explaining this would help future maintainers.📝 Suggested comment
+ // CommonMark §5.2: ordered markers that do not start with "1" + // cannot interrupt a paragraph, even when nested at content column. let force_paragraph_continuation = state.last_block_was_paragraph && !prev_was_blank && line_starts_with_ordered_marker_after_whitespace(p) && !nested_ordered_marker_starts_with_one(p);🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@crates/biome_markdown_parser/src/syntax/list.rs` around lines 2626 - 2674, Add a brief explanatory comment above the force_paragraph_continuation boolean that states this implements CommonMark §5.2: ordered list markers that do not start with `1` must not interrupt an ongoing paragraph even when they appear nested or at an indent where at_order_list_item fails to recognise them; mention the roles of line_starts_with_ordered_marker_after_whitespace and nested_ordered_marker_starts_with_one in the check and that the branch clears starts_nested_ordered / starts_nested_ordered_textual to force paragraph continuation.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@crates/biome_markdown_parser/src/syntax/list.rs`:
- Around line 2626-2674: Add a brief explanatory comment above the
force_paragraph_continuation boolean that states this implements CommonMark
§5.2: ordered list markers that do not start with `1` must not interrupt an
ongoing paragraph even when they appear nested or at an indent where
at_order_list_item fails to recognise them; mention the roles of
line_starts_with_ordered_marker_after_whitespace and
nested_ordered_marker_starts_with_one in the check and that the branch clears
starts_nested_ordered / starts_nested_ordered_textual to force paragraph
continuation.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 28caf81a-639a-4375-bb5c-a64061075cdb
⛔ Files ignored due to path filters (20)
crates/biome_markdown_parser/tests/md_test_suite/ok/block_quote_ordered_sublist_after_list_item.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_parser/tests/md_test_suite/ok/lazy_continuation_at_marker_indent.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_parser/tests/md_test_suite/ok/link_definition_indented_continuation.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_parser/tests/md_test_suite/ok/list_continuation_edge_cases.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_parser/tests/md_test_suite/ok/list_indentation.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_parser/tests/md_test_suite/ok/list_tightness.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_parser/tests/md_test_suite/ok/multiline_list.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_parser/tests/md_test_suite/ok/nested_bullet_indent_tokens.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_parser/tests/md_test_suite/ok/nested_lazy_continuation_loose_item.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_parser/tests/md_test_suite/ok/nested_lazy_continuation_same_marker_trailing.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_parser/tests/md_test_suite/ok/nested_lazy_continuation_trailing_paragraph.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_parser/tests/md_test_suite/ok/nested_list_blank_line_siblings.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_parser/tests/md_test_suite/ok/nested_list_double_blank.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_parser/tests/md_test_suite/ok/nested_list_double_blank_siblings.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_parser/tests/md_test_suite/ok/nested_list_interrupt_after_newline.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_parser/tests/md_test_suite/ok/nested_list_lazy_continuation_before_fence.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_parser/tests/md_test_suite/ok/nested_list_lazy_continuation_before_link_reference.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_parser/tests/md_test_suite/ok/nested_list_triple_blank_siblings.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_parser/tests/md_test_suite/ok/ordered_marker_non_one_no_interrupt.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_parser/tests/md_test_suite/ok/ordered_sublist_at_content_column.md.snapis excluded by!**/*.snapand included by**
📒 Files selected for processing (5)
crates/biome_markdown_parser/src/syntax/list.rscrates/biome_markdown_parser/src/syntax/mod.rscrates/biome_markdown_parser/tests/fuzz_generate_corpus.cjscrates/biome_markdown_parser/tests/md_test_suite/ok/ordered_marker_non_one_no_interrupt.mdcrates/biome_markdown_parser/tests/md_test_suite/ok/ordered_sublist_at_content_column.md
Note
I used Codex to help plan, implement, and validate this fix.
Summary
Fixes #10347. Fixes the broader class of Markdown parser list-continuation issues where nested list markers at an ordered item's content column were folded into the child marker prefix, and where non-
1ordered markers incorrectly interrupted paragraph continuation.Test Plan
Added CST fixtures and content-column-aware fuzz generators covering ordered sublists at the parent content column, quoted variants, and non-
1ordered marker paragraph continuation.Verified with:
just test-crate biome_markdown_parserDocs
N/A