fix(markdown_parser): restore leading-space stripping after hard line breaks#9934
Conversation
|
581af4f to
fb85ead
Compare
Merging this PR will not alter performance
Comparing Footnotes
|
e703e33 to
29027e5
Compare
WalkthroughRefactors paragraph-continuation and hard-line-break handling in the Markdown parser. Introduces 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@crates/biome_markdown_parser/src/syntax/mod.rs`:
- Around line 865-877: is_quote_blank_line_from_current currently mutates parser
state by calling consume_quote_prefix_without_virtual and p.bump while probing,
which can desynchronize later quote continuation checks; change the probe to be
non-mutating by making it operate on a snapshot or lookahead of the parser
(e.g., clone p or use a cursor/snapshot API) instead of bumping the real parser,
keeping the original checks (has_quote_prefix, MD_TEXTUAL_LITERAL whitespace
checks, NEWLINE/EOF detection) but performing them against the cloned/temporary
parser so consume_quote_prefix_without_virtual and p.bump are not invoked on the
live p.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: ba24faea-235c-4206-a8ea-46013b9bde9c
⛔ Files ignored due to path filters (3)
crates/biome_markdown_parser/tests/md_test_suite/ok/hard_break_in_blockquote.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_parser/tests/md_test_suite/ok/hard_break_in_list_item.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_parser/tests/md_test_suite/ok/hard_break_nested_quote_in_list.md.snapis excluded by!**/*.snapand included by**
📒 Files selected for processing (8)
crates/biome_markdown_parser/src/syntax/mod.rscrates/biome_markdown_parser/src/to_html.rscrates/biome_markdown_parser/tests/md_test_suite/ok/hard_break_in_blockquote.htmlcrates/biome_markdown_parser/tests/md_test_suite/ok/hard_break_in_blockquote.mdcrates/biome_markdown_parser/tests/md_test_suite/ok/hard_break_in_list_item.htmlcrates/biome_markdown_parser/tests/md_test_suite/ok/hard_break_in_list_item.mdcrates/biome_markdown_parser/tests/md_test_suite/ok/hard_break_nested_quote_in_list.htmlcrates/biome_markdown_parser/tests/md_test_suite/ok/hard_break_nested_quote_in_list.md
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.changeset/fix-markdown-quote-blank-line-probe.md:
- Line 5: Update the changeset text to mention both fixes: in addition to
"quoted hard-line-break handling" describe that the parser also restores
stripping continuation-line spaces after hard breaks in ordinary (plain)
paragraphs; edit the sentence in
.changeset/fix-markdown-quote-blank-line-probe.md to explicitly include
"plain-paragraph fix" or similar wording so the release note accurately reflects
both user-facing changes (quoted content behavior and plain paragraph
continuation-line space stripping).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 058e40cf-97b1-47e2-b8e4-131927b97443
📒 Files selected for processing (3)
.changeset/fix-markdown-quote-blank-line-probe.mdcrates/biome_markdown_parser/src/syntax/mod.rscrates/biome_markdown_parser/tests/spec_test.rs
✅ Files skipped from review due to trivial changes (1)
- crates/biome_markdown_parser/tests/spec_test.rs
| "@biomejs/biome": patch | ||
| --- | ||
|
|
||
| Fixed the Markdown parser's quoted hard-line-break handling so blank-line checks no longer consume quote prefixes while probing. This preserves correct continuation parsing for quoted content after hard breaks. |
There was a problem hiding this comment.
Please mention the plain-paragraph fix too.
The parser change also restores stripping continuation-line spaces after hard breaks in ordinary paragraphs, but this note only mentions quoted content. Worth folding both behaviours in so the release note matches what actually shipped. As per coding guidelines, "Changeset descriptions should focus on user-facing changes only".
🧰 Tools
🪛 LanguageTool
[uncategorized] ~5-~5: Possible missing comma found.
Context: ...arkdown parser's quoted hard-line-break handling so blank-line checks no longer consume ...
(AI_HYDRA_LEO_MISSING_COMMA)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.changeset/fix-markdown-quote-blank-line-probe.md at line 5, Update the
changeset text to mention both fixes: in addition to "quoted hard-line-break
handling" describe that the parser also restores stripping continuation-line
spaces after hard breaks in ordinary (plain) paragraphs; edit the sentence in
.changeset/fix-markdown-quote-blank-line-probe.md to explicitly include
"plain-paragraph fix" or similar wording so the release note accurately reflects
both user-facing changes (quoted content behavior and plain paragraph
continuation-line space stripping).
There was a problem hiding this comment.
What's this for? Mistake maybe?
Per maintainer feedback, these HTML reference files are not needed for the hard break parser fix.
Note
This PR was created with AI assistance (Claude Code).
Summary
Follow-up to #9931. Fixes a regression from #9933 where hard breaks inside blockquotes stopped producing
<br />, and continuation-line spaces after hard breaks were preserved in plain paragraphs.For non-container paragraphs, the parser now strips CommonMark §6.7 continuation spaces before line-continuation handling. Container contexts are unchanged.
Test Plan
just test-crate biome_markdown_parserjust test-markdown-conformancecargo test -p biome_markdown_formatterjust fDocs
N/A