fix(markdown_parser): mixed bullet markers and lazy continuation in lists#9933
Conversation
…ists Two fixes in list parsing: 1. `BulletList::is_at_list_end` early return checked for a following bullet item without checking whether the marker changed. After non-paragraph first-line blocks (headings, thematic breaks, setext headings, fenced code), the item loop broke at a blank-introducing NEWLINE that hit this early return, so `- # H\n\n+ x` merged into one list instead of splitting into two. 2. `check_continuation_indent` returned `Break` unconditionally when `indent < marker_indent`, preventing lazy continuation below the marker column. `- a\n - b\n lazy\nhello` broke `hello` out of the nested item instead of treating it as lazy continuation per CommonMark §5.2.
|
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 (2)
📒 Files selected for processing (2)
WalkthroughThis PR refines markdown list parsing to handle blank-line edge cases. It modifies Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 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 |
ematipico
left a comment
There was a problem hiding this comment.
These fixes will make the formatter's life easier
Almost there!
The fuzzer is helping a ton! |
Note
This PR was created with AI assistance (Claude Code).
Summary
Two fixes in
crates/biome_markdown_parser/src/syntax/list.rs:Mixed bullet markers don't split lists after non-paragraph content.
BulletList::is_at_list_endhad an early return that checkedhas_bullet_item_after_blank_lines_at_indentwithout checking whether the bullet marker changed. After headings, setext headings, and fenced code blocks, the item loop broke at a blank-introducing NEWLINE that hit this path, so- # H\n\n+ xmerged into one<ul>instead of two. Addedmarker_changes_after_blank_linesto the early return.Lazy continuation lines not absorbed into nested list items.
check_continuation_indentreturnedBreakunconditionally whenindent < marker_indent, preventing lazy continuation below the marker column. Per CommonMark §5.2,- a\n - b\n lazy\nhelloshould keephelloinside the nested item. Now checks for lazy eligibility before breaking.Note:
- ---is a pre-existing markdown parser bug where it parses as a top-level thematic break instead of a list item containing<hr />; not addressed here.Test Plan
just test-crate biome_markdown_parserjust test-markdown-conformancespec_test.rsheader_in_list.md,thematic_break_in_list.md)Docs
N/A