refactor(markdown): emit continuation indent as structural CST node#9737
Conversation
|
Merging this PR will not alter performance
Comparing Footnotes
|
467b771 to
973ae6c
Compare
|
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 (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThe PR makes continuation-line indentation an explicit CST leaf by adding MdContinuationIndent across grammar, codegen, parser, formatter and HTML renderer. The parser now emits MD_CONTINUATION_INDENT instead of skipping the structural indent; codegen and kind registry include the new node; formatter rule and AsFormat/IntoFormat impls are added; AnyMdLeafBlock and HTML rendering are updated so continuation indents are treated as opaque/no-output leaf blocks. (≈70 words) 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/list.rs`:
- Around line 2039-2043: Add regression fixtures that reproduce and lock the CST
change where an explicit MdContinuationIndent node is emitted: create a parser
snapshot test for the `#9725` reproducer that ensures the CST contains
MD_CONTINUATION_INDENT produced by the code path using p.start(),
p.emit_line_indent(state.required_indent), and ci_m.complete(p,
MD_CONTINUATION_INDENT); additionally add a formatter snapshot for the same
input to ensure to_html stays no-output but the CST shape is preserved; include
both parser and formatter test files (valid case reproducer plus any minimal
error case if applicable) so the fix is covered by the test suite.
🪄 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: f1af8a13-0148-4b28-b2d9-036f9e7b3162
⛔ Files ignored due to path filters (10)
crates/biome_markdown_factory/src/generated/node_factory.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_markdown_factory/src/generated/syntax_factory.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_markdown_parser/tests/md_test_suite/ok/fenced_code_in_list.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_parser/tests/md_test_suite/ok/list_continuation_edge_cases.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_parser/tests/md_test_suite/ok/list_indentation.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_parser/tests/md_test_suite/ok/setext_heading_edge_cases.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_syntax/src/generated/kind.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_markdown_syntax/src/generated/macros.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_markdown_syntax/src/generated/nodes.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_markdown_syntax/src/generated/nodes_mut.rsis excluded by!**/generated/**,!**/generated/**and included by**
📒 Files selected for processing (9)
crates/biome_markdown_formatter/src/generated.rscrates/biome_markdown_formatter/src/markdown/any/leaf_block.rscrates/biome_markdown_formatter/src/markdown/auxiliary/continuation_indent.rscrates/biome_markdown_formatter/src/markdown/auxiliary/mod.rscrates/biome_markdown_parser/src/syntax/list.rscrates/biome_markdown_parser/src/to_html.rscrates/biome_markdown_parser/tests/spec_test.rsxtask/codegen/markdown.ungramxtask/codegen/src/markdown_kinds_src.rs
💤 Files with no reviewable changes (1)
- crates/biome_markdown_parser/tests/spec_test.rs
973ae6c to
006be48
Compare
Add MdContinuationIndent to the grammar so list continuation indent is represented as an explicit block-level node instead of skipped trivia on the next token. - Extend AnyMdLeafBlock with MdContinuationIndent in markdown.ungram - Add MD_CONTINUATION_INDENT to kind.rs - Replace skip_line_indent with emit_line_indent wrapped in MdContinuationIndent in check_continuation_indent - Skip MdContinuationIndent in HTML rendering and block iteration - Regenerate grammar and formatter code
006be48 to
4745ed0
Compare
dyc3
left a comment
There was a problem hiding this comment.
It's a bit hard for me to understand what a "Continuation Indent" is.
@dyc3 it is the whitespace that keeps continuation lines inside a list item (CommonMark §5.2). Example: the two spaces before I added a clarifying comment. |
|
oh, i see, makes sense then |
Note
This PR was created with AI assistance (Claude Code).
Summary
Refs #9725.
Promote list continuation indent from trivia to an explicit
MdContinuationIndentCST node. This gives the formatter structural access to continuation indentation instead of relying on trivia.MdContinuationIndentto grammar as anAnyMdLeafBlockskip_line_indentwithemit_line_indentwrapped inMdContinuationIndentfor list continuationMdContinuationIndentin HTML rendering and block iterationrender_fenced_code_blockindent computation now that continuation indent is structuralTest Plan
just test-crate biome_markdown_parser— all passedjust test-crate biome_markdown_formatter— all passedjust test-markdown-conformance— 652/652just fjust lDocs
N/A.