Skip to content

fix(markdown_parser): parse tab-indented siblings#10333

Merged
ematipico merged 1 commit into
biomejs:mainfrom
jfmcdowell:fix/md-sibling-list-marker-indent
May 11, 2026
Merged

fix(markdown_parser): parse tab-indented siblings#10333
ematipico merged 1 commit into
biomejs:mainfrom
jfmcdowell:fix/md-sibling-list-marker-indent

Conversation

@jfmcdowell

@jfmcdowell jfmcdowell commented May 11, 2026

Copy link
Copy Markdown
Contributor

Note

I used Claude Code to plan and implement this fix.

Summary

Fixes #10295

The markdown parser now treats tab-indented sibling list markers below the current item continuation indent as list-interrupting blocks. This preserves the nested list CST shape expected by the formatter.

Fixes a whitespace issue in .changeset/bright-dragons-clean.md to make the CI happy.

No changeset: this is an internal markdown parser conformance fix.

Test Plan

  • Added parser snapshot coverage for the tab-indented sibling list case.
  • Updated markdown formatter snapshots for affected tab list fixtures.
  • just test-crate biome_markdown_parser
  • just test-crate biome_markdown_formatter
  • just test-markdown-conformance

Docs

N/A

@changeset-bot

changeset-bot Bot commented May 11, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: fc057de

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 changesets to release 13 packages
Name Type
@biomejs/biome Patch
@biomejs/cli-win32-x64 Patch
@biomejs/cli-win32-arm64 Patch
@biomejs/cli-darwin-x64 Patch
@biomejs/cli-darwin-arm64 Patch
@biomejs/cli-linux-x64 Patch
@biomejs/cli-linux-arm64 Patch
@biomejs/cli-linux-x64-musl Patch
@biomejs/cli-linux-arm64-musl Patch
@biomejs/wasm-web Patch
@biomejs/wasm-bundler Patch
@biomejs/wasm-nodejs Patch
@biomejs/backend-jsonrpc Patch

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 A-Formatter Area: formatter L-Markdown Language: Markdown labels May 11, 2026
@codspeed-hq

codspeed-hq Bot commented May 11, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 28 untouched benchmarks
⏩ 228 skipped benchmarks1


Comparing jfmcdowell:fix/md-sibling-list-marker-indent (fc057de) with main (9b1577f)

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 force-pushed the fix/md-sibling-list-marker-indent branch 7 times, most recently from 7ac3e11 to 04e4d1e Compare May 11, 2026 14:13
@jfmcdowell jfmcdowell force-pushed the fix/md-sibling-list-marker-indent branch from 04e4d1e to fc057de Compare May 11, 2026 14:25
@jfmcdowell jfmcdowell marked this pull request as ready for review May 11, 2026 14:51
@coderabbitai

coderabbitai Bot commented May 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack
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: 7c725a82-36b6-4d4b-906a-7e8e797294ea

📥 Commits

Reviewing files that changed from the base of the PR and between 3f02f4a and fc057de.

⛔ Files ignored due to path filters (2)
  • crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/nested-tab.md.snap is excluded by !**/*.snap and included by **
  • crates/biome_markdown_parser/tests/md_test_suite/ok/nested_list_tab_indented_siblings.md.snap is excluded by !**/*.snap and included by **
📒 Files selected for processing (3)
  • .changeset/bright-dragons-clean.md
  • crates/biome_markdown_parser/src/syntax/mod.rs
  • crates/biome_markdown_parser/tests/md_test_suite/ok/nested_list_tab_indented_siblings.md

Walkthrough

This PR fixes incorrect parsing of nested Markdown lists with tab indentation (issue #10295). The core change refactors the break_for_list_interrupt_after_inline_newline function to distinguish dedent cases by comparing indentation against both required_indent and list_item_marker_indent, with special handling for tab-containing indentation. Two new helper functions detect tab usage in indentation runs and perform lookahead to check for list markers. A test fixture validates the fix using tab-indented multi-level nesting.

Possibly related PRs

  • biomejs/biome#10170: Modifies markdown parser list continuation and block-interrupt detection logic similarly for nested-list edge cases.
  • biomejs/biome#9785: Adds lookahead helpers checking for list markers after newlines and indentation, handling tab edge cases.
  • biomejs/biome#10194: Modifies list-interrupt and lookahead logic to detect textual list markers and prevent lazy continuation.

Suggested reviewers

  • dyc3
  • ematipico
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix(markdown_parser): parse tab-indented siblings' accurately reflects the main change—fixing markdown parser handling of tab-indented sibling list markers.
Description check ✅ Passed The description clearly relates to the changeset, explaining the fix for issue #10295 regarding tab-indented nested list parsing and the whitespace fix in the changeset file.
Linked Issues check ✅ Passed The PR successfully addresses issue #10295 by updating list interrupt detection logic to treat tab-indented sibling markers as list-interrupting blocks, preserving proper nested list CST structure.
Out of Scope Changes check ✅ Passed All changes are in scope: markdown parser logic updates, test fixture additions, changeset manifest fix, and formatter snapshot updates directly support the tab-indented list parsing objective.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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.

@jfmcdowell

Copy link
Copy Markdown
Contributor Author

I will submit a follow up PR to address findings related to this class of problem found by the differential fuzzer

@ematipico ematipico left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you!

@ematipico ematipico merged commit d50546a into biomejs:main May 11, 2026
28 checks passed
@jfmcdowell jfmcdowell deleted the fix/md-sibling-list-marker-indent branch May 11, 2026 16:59
jfmcdowell added a commit to jfmcdowell/biome that referenced this pull request May 16, 2026
Inside a list item, a sibling ordered marker at column <= the item's
marker_indent must end the current paragraph (CommonMark §5.2).
break_for_list_interrupt_after_inline_newline only ran the marker
lookahead when the leading whitespace contained a tab, so a non-tab
sibling ordered marker was missed whenever the parent's post-marker
space widened required_indent past the sibling's column.

Reproducer (biomejs#10374):

    1.  first
    2.  second
        1.   third
        2.   fourth

Inner item `1.   third` has marker_indent=4, required_indent=9. The
next line at indent 4 is a sibling, but `indent < required_indent` and
no tab in the leading whitespace, so the break check returned false and
`2.   fourth` plus its leading 4 spaces were swallowed as
MD_TEXTUAL_LITERALs inside the first inner item's paragraph.

The non-tab path now runs a narrow token lookahead that only flags
non-1 ordered markers — parse_inline_item_list's
textual_looks_like_list_marker already terminates on bullets and on
`1.`/`1)`, so widening to all marker shapes regressed
synthetic/nested-lists by ~10% without buying additional correctness.
The tab path keeps the original token-aware lookahead (biomejs#10333).

Verified:
- cargo test -p biome_markdown_parser (all 256 tests pass)
- cargo test -p biome_markdown_formatter (all 839 tests pass)
- cargo bench synthetic/nested-lists: cached +5%, uncached noise
jfmcdowell added a commit to jfmcdowell/biome that referenced this pull request May 16, 2026
Inside a list item, a sibling ordered marker at column <= the item's
marker_indent must end the current paragraph (CommonMark §5.2).
break_for_list_interrupt_after_inline_newline only ran the marker
lookahead when the leading whitespace contained a tab, so a non-tab
sibling ordered marker was missed whenever the parent's post-marker
space widened required_indent past the sibling's column.

Reproducer (biomejs#10374):

    1.  first
    2.  second
        1.   third
        2.   fourth

Inner item `1.   third` has marker_indent=4, required_indent=9. The
next line at indent 4 is a sibling, but `indent < required_indent` and
no tab in the leading whitespace, so the break check returned false and
`2.   fourth` plus its leading 4 spaces were swallowed as
MD_TEXTUAL_LITERALs inside the first inner item's paragraph.

The non-tab path now runs a narrow token lookahead that only flags
non-1 ordered markers — parse_inline_item_list's
textual_looks_like_list_marker already terminates on bullets and on
`1.`/`1)`, so widening to all marker shapes regressed
synthetic/nested-lists by ~10% without buying additional correctness.
The tab path keeps the original token-aware lookahead (biomejs#10333).

Verified:
- cargo test -p biome_markdown_parser (all 256 tests pass)
- cargo test -p biome_markdown_formatter (all 839 tests pass)
- cargo bench synthetic/nested-lists: cached +5%, uncached noise
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Formatter Area: formatter A-Parser Area: parser L-Markdown Language: Markdown

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 Incorrect parsing of nested lists with. tabs

2 participants