refactor(markdown-parser): promote remaining skipped trivia to explicit CST nodes#9427
Conversation
|
…it CST nodes Promote structurally significant tokens that were hidden via parse_as_skipped_trivia_tokens to proper CST nodes visible to traversal and the formatter. Grammar: add indent: MdIndentTokenList to MdHeader, MdFencedCodeBlock, MdHtmlBlock, and MdLinkReferenceDefinition. Add r_fence_indent slot to MdFencedCodeBlock for closing fence indentation. Parser: add emit_line_indent() for block prefix indent (emits MdIndentTokenList) and emit_indent_tokens() for continuation indent inside inline item lists. Add emit_optional_marker_space() for quote post-marker space. Wrap quote-inside-list marker in proper MdQuotePrefix node. Remaining parse_as_skipped_trivia_tokens calls are all in error recovery paths where tokens genuinely should be invisible.
cffe70a to
8531525
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 ignored due to path filters (45)
📒 Files selected for processing (12)
WalkthroughThis PR converts previously-skipped indentation and quote prefix trivia into explicit concrete syntax tree (CST) nodes. Parser methods 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)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). 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 |
|
@tidefield for visibility. |
ematipico
left a comment
There was a problem hiding this comment.
I noticed that some nodes don't have a comment that show the "code version" of them. Would you mind having a pass at that, and send PR that updates the ungram file?
|
|
||
| // html block - content is stored as raw text (multiple textual tokens) | ||
| MdHtmlBlock = content: MdInlineItemList | ||
| MdHtmlBlock = |
There was a problem hiding this comment.
comment that shows the code is missing
| // Link reference definition per CommonMark §4.7 | ||
| // [label]: destination "title" or [label]: destination 'title' or [label]: destination (title) | ||
| // Labels are case-insensitive and whitespace-normalized | ||
| MdLinkReferenceDefinition = |
Note
AI Assistance Disclosure: This PR was developed with assistance from Claude Code.
Summary
Promote structurally significant tokens from
parse_as_skipped_trivia_tokensto explicit CST nodes, continuing #9337 and #9321.indent: MdIndentTokenListgrammar slots toMdHeader,MdFencedCodeBlock,MdHtmlBlock,MdLinkReferenceDefinition. Addr_fence_indenttoMdFencedCodeBlock.emit_line_indent()andemit_indent_tokens()parser methods; replaceskip_line_indent()/consume_indent_prefix()/consume_partial_quote_prefix()across block parsers.emit_optional_marker_space()and wrap quote-inside-list markers in properMdQuotePrefixnodes.to_html.rsto read indent from explicit slots instead of trivia.Remaining
parse_as_skipped_trivia_tokenscalls are limited to error-recovery paths. No intended CLI or format output behavior change. Formatter snapshot updates are structural only (no new formatting logic).Test Plan
just test-crate biome_markdown_parserjust test-markdown-conformance(652/652, 100%)just f && just lDocs
N/A — internal structural change.