Skip to content

fix(markdown_parser): mixed bullet markers and lazy continuation in lists#9933

Merged
ematipico merged 1 commit intobiomejs:mainfrom
jfmcdowell:fix/md-parser-list-bugs
Apr 12, 2026
Merged

fix(markdown_parser): mixed bullet markers and lazy continuation in lists#9933
ematipico merged 1 commit intobiomejs:mainfrom
jfmcdowell:fix/md-parser-list-bugs

Conversation

@jfmcdowell
Copy link
Copy Markdown
Contributor

Note

This PR was created with AI assistance (Claude Code).

Summary

Two fixes in crates/biome_markdown_parser/src/syntax/list.rs:

  1. Mixed bullet markers don't split lists after non-paragraph content. BulletList::is_at_list_end had an early return that checked has_bullet_item_after_blank_lines_at_indent without 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+ x merged into one <ul> instead of two. Added marker_changes_after_blank_lines to the early return.

  2. Lazy continuation lines not absorbed into nested list items. check_continuation_indent returned Break unconditionally when indent < marker_indent, preventing lazy continuation below the marker column. Per CommonMark §5.2, - a\n - b\n lazy\nhello should keep hello inside 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_parser
  • just test-markdown-conformance
  • 8 targeted fuzz regression tests added to spec_test.rs
  • 2 CST snapshots updated (header_in_list.md, thematic_break_in_list.md)

Docs

N/A

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

changeset-bot bot commented Apr 12, 2026

⚠️ No Changeset found

Latest commit: 7751648

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 Apr 12, 2026
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Apr 12, 2026

Merging this PR will not alter performance

✅ 28 untouched benchmarks
⏩ 228 skipped benchmarks1


Comparing jfmcdowell:fix/md-parser-list-bugs (7751648) with main (1aa85f5)

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 April 12, 2026 09:47
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 12, 2026

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: 2ec13370-b525-420a-9071-9845a723ef10

📥 Commits

Reviewing files that changed from the base of the PR and between 1aa85f5 and 7751648.

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

Walkthrough

This PR refines markdown list parsing to handle blank-line edge cases. It modifies BulletList::is_at_list_end to detect when bullet markers change across blank lines (forcing list boundaries) and updates check_continuation_indent to conditionally allow lazy continuation based on whether the next line starts a list item or contains a block interrupt. Additionally, comprehensive test cases validate mixed-marker scenarios and lazy-continuation behaviour against expected HTML output.

Possibly related PRs

Suggested reviewers

  • ematipico
  • dyc3
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title directly and clearly describes the main changes: fixing mixed bullet markers and lazy continuation handling in lists.
Description check ✅ Passed The description is well-related to the changeset, detailing the two specific fixes, test plan, and noting a pre-existing bug not addressed.

✏️ 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.

Copy link
Copy Markdown
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

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

These fixes will make the formatter's life easier

Almost there!

@ematipico ematipico merged commit 3b334c0 into biomejs:main Apr 12, 2026
16 checks passed
@jfmcdowell
Copy link
Copy Markdown
Contributor Author

These fixes will make the formatter's life easier

Almost there!

The fuzzer is helping a ton!

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