fix(markdown_parser): trim trailing newline in tight lists inside blockquotes#9976
fix(markdown_parser): trim trailing newline in tight lists inside blockquotes#9976jfmcdowell wants to merge 2 commits intobiomejs:mainfrom
Conversation
…ckquotes MdQuotePrefix blocks leaked into list item content, causing last_is_paragraph to evaluate false and skip trailing newline trimming on the first <li> of tight lists nested in blockquotes.
|
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 selected for processing (1)
WalkthroughThe PR updates Markdown-to-HTML list tightness and trimming logic: it 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.
🧹 Nitpick comments (1)
crates/biome_markdown_parser/src/to_html.rs (1)
1776-1787: Consider making transparency the single source of truth.Now that
is_transparent_blockexists, it may be worth routingis_empty_content/is_newline_blockthrough it to avoid helper drift later.Possible tidy-up
fn is_newline_block(block: &AnyMdBlock) -> bool { - matches!( - block, - AnyMdBlock::AnyMdLeafBlock( - AnyMdLeafBlock::MdNewline(_) | AnyMdLeafBlock::MdContinuationIndent(_), - ) - ) + is_transparent_block(block) } /// Check if blocks are effectively empty (empty or only newlines). fn is_empty_content(blocks: &[AnyMdBlock]) -> bool { - blocks.is_empty() || blocks.iter().all(is_newline_block) + blocks.is_empty() || blocks.iter().all(is_transparent_block) }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@crates/biome_markdown_parser/src/to_html.rs` around lines 1776 - 1787, is_transparent_block should be the single source of truth for blocks that render no content; update callers and helper predicates (e.g., is_empty_content, is_newline_block) to delegate to is_transparent_block instead of re-implementing the same checks. Find usages of is_empty_content and is_newline_block and replace their internal logic with a call to is_transparent_block(&block) (or have them return is_transparent_block result), keeping any additional semantics only when strictly necessary and adding small adapters that call is_transparent_block to preserve existing API shapes.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@crates/biome_markdown_parser/src/to_html.rs`:
- Around line 1776-1787: is_transparent_block should be the single source of
truth for blocks that render no content; update callers and helper predicates
(e.g., is_empty_content, is_newline_block) to delegate to is_transparent_block
instead of re-implementing the same checks. Find usages of is_empty_content and
is_newline_block and replace their internal logic with a call to
is_transparent_block(&block) (or have them return is_transparent_block result),
keeping any additional semantics only when strictly necessary and adding small
adapters that call is_transparent_block to preserve existing API shapes.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 2d52d4ba-6540-4615-b76f-39719cb9fe31
📒 Files selected for processing (1)
crates/biome_markdown_parser/src/to_html.rs
|
@codersbbitai: I addressed your nit comment in 4acaa14. However it surfaced an unrelated to our change snapshot failure in the latest CI run. |
Note
This PR was created with AI assistance (Claude Code).
Summary
Fixes spurious trailing
\ninside the first<li>of tight lists nested in blockquotes.> - a\n> - brendered<li>a\n</li>instead of<li>a</li>.Root cause:
MdQuotePrefixblocks leaked into list item content, causinglast_is_paragraphto evaluate false and skip trailing newline trimming. Introducesis_transparent_block()to skip structural-only blocks (MdNewline,MdContinuationIndent,MdQuotePrefix) when determining paragraph boundaries for tightness.Test Plan
just test-crate biome_markdown_parserjust test-markdown-conformanceDocs
N/A