refactor(markdown-parser): promote blank lines between list items to MdNewline nodes#9313
Conversation
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (4)
📒 Files selected for processing (8)
🚧 Files skipped from review as they are similar to previous changes (7)
WalkthroughThis change makes blank lines between list items explicit in the CST by adding a new union AnyMdBulletListMember = MdBullet | MdNewline, updates the parser to emit MdNewline nodes between bullets, extends to_html to locate MdBullet through the new union, adds a generated formatter FormatAnyMdBulletListMember plus AsFormat/IntoFormat impls and a pub(crate) bullet_list_member formatter module, and adds tests exercising blank lines between list items. 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.
Seems there's a conflict to solve
…m skipped trivia to MdNewline nodes Introduces AnyMdBulletListMember = MdBullet | MdNewline union so that MdBulletList can hold explicit MdNewline CST nodes for blank lines between items, replacing the previous parse_as_skipped_trivia_tokens approach in skip_blank_lines_between_items. This is the final trivia-promotion site in Phase 2c. Key changes: - Grammar: MdBulletList = AnyMdBulletListMember* (was MdBullet*) - Parser: skip_blank_lines_between_items emits MdNewline nodes - Consumer: to_html.rs uses iter().find_map() for ordered list start - Codegen: regenerated formatter/syntax/factory files
fb05546 to
f2c5204
Compare
@ematipico resolved |
Note
AI Assistance Disclosure: This PR was developed with assistance from Claude Code.
Summary
AnyMdBulletListMember = MdBullet | MdNewlineunion to the grammar, soMdBulletListcan hold both item nodes and blank-line nodes as children.MdBulletListfromMdBullet*toAnyMdBulletListMember*.skip_blank_lines_between_itemsto emit explicitMdNewlineCST nodes instead of callingparse_as_skipped_trivia_tokens.to_html.rsordered list start extraction to useiter().find_map()to unwrapAnyMdBulletListMember::MdBullet(replacing direct.first()call).AnyMdBulletListMember(no manual formatter changes).This is the follow-up to #9274.
skip_blank_lines_between_itemswas the last remaining skipped-trivia call site for blank lines in list parsing. Each inter-item blank line is now a realMdNewlineCST node visible to the formatter harness.No user-facing behavior change. Parsed semantics and CommonMark conformance are preserved (652/652); only the internal CST representation changes.
Test Plan
cargo test -p biome_markdown_parser— 131 tests pass (63 + 68)cargo run -p xtask_coverage -- --suites=markdown/commonmark— 652/652 (100%)cargo check -p biome_markdown_formatter— compiles cleanlyjust l— lint passesMdNewlinenodes appear betweenMdBulletsiblings in loose lists; tight lists have noMdNewlinebetween siblingsDocs
N/A — internal structural change, no new user-facing features.