Conversation
|
Merging this PR will not alter performance
Comparing Footnotes
|
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughAdds a gated Possibly related PRs
Suggested labels
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)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
crates/biome_markdown_formatter/src/context.rs (1)
120-129:⚠️ Potential issue | 🟠 MajorReturn the stored
source_mapfrom theFormatContextimplementation.Line 128 always returns
None, so the value set viawith_source_map()is never exposed through the trait. This differs frombiome_js_formatter,biome_grit_formatter, andbiome_html_formatter, which all returnself.source_map.as_ref().Proposed fix
impl FormatContext for MdFormatContext { type Options = MdFormatOptions; fn options(&self) -> &Self::Options { &self.options } fn source_map(&self) -> Option<&TransformSourceMap> { - None + self.source_map.as_ref() } }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@crates/biome_markdown_formatter/src/context.rs` around lines 120 - 129, The FormatContext implementation for MdFormatContext incorrectly returns None from fn source_map(&self) -> Option<&TransformSourceMap>, so the source_map set via with_source_map() is never exposed; change the implementation of MdFormatContext::source_map to return the stored Option by returning self.source_map.as_ref() (matching the pattern used in biome_js_formatter/biome_grit_formatter/biome_html_formatter) so callers of FormatContext can access the underlying TransformSourceMap.
🧹 Nitpick comments (2)
crates/biome_markdown_formatter/src/lib.rs (1)
220-255: Add a focused suppression regression spec.This default path now drives suppression and comment output for every Markdown node; a dedicated spec for local + global suppression would make future changes safer.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@crates/biome_markdown_formatter/src/lib.rs` around lines 220 - 255, The default formatting path now defers to format_suppressed_node when a node is locally or globally suppressed (see fmt implementation that calls is_suppressed/is_global_suppressed and write!(f, [format_suppressed_node(node.syntax())])), so add a focused regression spec that covers both local suppression and global suppression: create tests that exercise is_suppressed and is_global_suppressed behavior by feeding nodes with local suppression comments, nodes with global suppression markers, and combinations (local + global) and assert the output is identical to the source (comments preserved) and that normal formatting paths (fmt_leading_comments/fmt_fields/fmt_dangling_comments/fmt_trailing_comments) are skipped; target the tests at the MarkdownFormatter entrypoint used in other specs so they fail if the suppression checks or format_suppressed_node handling regress.crates/biome_markdown_formatter/tests/spec_test.rs (1)
54-54: Remove or address commented-out code.This commented line appears to be leftover from development. Either remove it or implement the source type handling if needed.
🧹 Suggested cleanup
- // let source_type: MdFileSource = test_file.input_file().as_path().try_into().unwrap();🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@crates/biome_markdown_formatter/tests/spec_test.rs` at line 54, The commented-out line with MdFileSource in the test indicates dead or unfinished code; either delete the commented line or implement proper source type handling by converting the test file path into an MdFileSource using test_file.input_file().as_path().try_into().unwrap() (or a fallible conversion with expect/error handling) and then use that MdFileSource in the test flow (locate the commented token referencing MdFileSource and test_file.input_file().as_path().try_into().unwrap() to update or remove accordingly).
🤖 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_configuration/src/markdown.rs`:
- Line 65: The doc comment in markdown.rs currently says "The type of line
ending applied to JSON (and its super languages) files." — change that wording
to refer to Markdown instead (e.g., "The type of line ending applied to Markdown
(and its super languages) files" or similar) so the documentation matches the
Markdown configuration item; update the docstring where this text appears in
markdown.rs (the doc comment for the line-ending option) to replace "JSON" with
"Markdown".
In `@crates/biome_markdown_formatter/src/markdown/auxiliary/hard_line.rs`:
- Line 7: The code currently strips the backslash with
format_removed(&node.value_token()?) but never emits a newline, losing hard line
breaks; update the hard_line.rs handling so after calling
format_removed(&node.value_token()?).fmt(f) you also emit the explicit break
(e.g. call hard_line_break().fmt(f) or line().fmt(f) as appropriate) to preserve
the Markdown hard line semantics for the node returned by node.value_token().
In `@crates/biome_markdown_formatter/tests/spec_test.rs`:
- Around line 13-29: The top-level doc comment in tests/spec_test.rs incorrectly
references CSS formatter files and examples (e.g., `css/null`,
`{spec_name}.css`, `tests/specs/css/null.css.snap`); update all occurrences to
refer to Markdown instead (e.g., `{spec_name}.md`, `tests/specs/md/null.md`,
`tests/specs/md/null.md.snap` or simply `md/null` as the example) so the
documentation matches the Markdown formatter tests and paths used by this crate.
---
Outside diff comments:
In `@crates/biome_markdown_formatter/src/context.rs`:
- Around line 120-129: The FormatContext implementation for MdFormatContext
incorrectly returns None from fn source_map(&self) ->
Option<&TransformSourceMap>, so the source_map set via with_source_map() is
never exposed; change the implementation of MdFormatContext::source_map to
return the stored Option by returning self.source_map.as_ref() (matching the
pattern used in biome_js_formatter/biome_grit_formatter/biome_html_formatter) so
callers of FormatContext can access the underlying TransformSourceMap.
---
Nitpick comments:
In `@crates/biome_markdown_formatter/src/lib.rs`:
- Around line 220-255: The default formatting path now defers to
format_suppressed_node when a node is locally or globally suppressed (see fmt
implementation that calls is_suppressed/is_global_suppressed and write!(f,
[format_suppressed_node(node.syntax())])), so add a focused regression spec that
covers both local suppression and global suppression: create tests that exercise
is_suppressed and is_global_suppressed behavior by feeding nodes with local
suppression comments, nodes with global suppression markers, and combinations
(local + global) and assert the output is identical to the source (comments
preserved) and that normal formatting paths
(fmt_leading_comments/fmt_fields/fmt_dangling_comments/fmt_trailing_comments)
are skipped; target the tests at the MarkdownFormatter entrypoint used in other
specs so they fail if the suppression checks or format_suppressed_node handling
regress.
In `@crates/biome_markdown_formatter/tests/spec_test.rs`:
- Line 54: The commented-out line with MdFileSource in the test indicates dead
or unfinished code; either delete the commented line or implement proper source
type handling by converting the test file path into an MdFileSource using
test_file.input_file().as_path().try_into().unwrap() (or a fallible conversion
with expect/error handling) and then use that MdFileSource in the test flow
(locate the commented token referencing MdFileSource and
test_file.input_file().as_path().try_into().unwrap() to update or remove
accordingly).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: e46f6d63-0fcd-4619-b3e0-50dd97ae3135
⛔ Files ignored due to path filters (261)
crates/biome_markdown_factory/src/generated/node_factory.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_markdown_formatter/tests/specs/markdown/headers.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/blockquote/code.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/blockquote/ignore-code.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/blockquote/nested.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/blockquote/notext-end.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/break/simple.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/break/wrap.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/broken-plugins/missing-comments.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/0-indent-js.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/additional-space.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/angular/angular-html.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/angular/angular-ts.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/backtick.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/indent.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-auth-api.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-background-1.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-background-2.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-background-3.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-background-4.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-background-5.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-background-6.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-background-7.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-background-8.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-background-9.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-filter-1.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-filter-2.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-font-face-1.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-font-face-2.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-grid-auto-columns.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-import.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-mask-image.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-padding-1.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-padding-2.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-transform.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-unicode-range.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/cursor/17227.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/emphasis/asterisk.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/emphasis/complex.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/emphasis/special.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/footnoteDefinition/long.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/footnoteDefinition/multiline.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/footnoteDefinition/sibling.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/front-matter/custom-parser.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/front-matter/empty.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/heading/setext.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/html/multiline-with-trailing-space.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/html/multiline.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/ignore/top-level-range.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/indentation/example.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/inlineCode/backtick.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/link/encodedLink.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/link/title.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/linkReference/case-and-space/case-and-space.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/linkReference/case-and-space/issue-7118.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/linkReference/definition.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/linkReference/title.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/liquid/unbalanced-mismatched-braces.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/liquid/unbalanced-object-close-only.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/liquid/unbalanced-object-open-only.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/liquid/unbalanced-template-close-only.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/liquid/unbalanced-template-open-only.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/align.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/codeblock.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/combined-lists.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/git-diff-friendly.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/indent.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/interrupt.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/issue-17652.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/issue-7846.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/loose.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/nested-checkbox.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/nested-tab.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/start.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/tab.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/unordered.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/long-table/long-table.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/markdown/real-world-case.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/markdown/test-case.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/math/math-like.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/math/remark-math.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/multiparser-js/jsx-comment.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/multiparser-js/meta-in-code-block.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/multiparser-json/invalid-json.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/paragraph/inline-nodes.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/paragraph/lorem.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/paragraph/special-prefix.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/commonmark-0.30-example-329.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/commonmark-0.30-example-335.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/commonmark-0.30-example-336.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/commonmark-0.30-example-337.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-1.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-100.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-102.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-103.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-104.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-105.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-106.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-107.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-108.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-11.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-110.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-111.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-112.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-113.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-117.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-120.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-132.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-133.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-14.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-140.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-141.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-149.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-15.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-152.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-157.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-158.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-159.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-162.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-17.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-170.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-176.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-177.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-18.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-181.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-182.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-183.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-184.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-185.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-186.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-187.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-188.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-189.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-19.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-190.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-192.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-193.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-194.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-195.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-196.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-197.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-198.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-2.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-20.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-200.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-201.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-205.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-206.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-207.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-209.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-21.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-210.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-211.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-212.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-217.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-218.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-219.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-22.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-220.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-222.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-229.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-23.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-232.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-234.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-235.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-236.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-237.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-238.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-240.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-242.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-244.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-245.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-246.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-247.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-249.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-25.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-250.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-251.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-252.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-254.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-255.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-256.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-259.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-26.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-260.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-261.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-262.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-263.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-264.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-265.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-266.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-267.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-268.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-269.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-27.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-272.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-273.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-274.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-276.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-277.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-28.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-282.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-286.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-287.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-288.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-289.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-29.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-292.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-295.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-296.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-297.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-298.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-30.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-305.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-306.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-307.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-311.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-313.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-317.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-325.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-326.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-328.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-33.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-333.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-334.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-336.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-337.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-339.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-340.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-341.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-346.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-347.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-348.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-349.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-35.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-356.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-357.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-358.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-359.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-36.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-360.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-361.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-362.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-363.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-364.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-367.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-368.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-369.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-37.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-371.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-372.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-373.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-374.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-375.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-376.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-377.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-378.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-379.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-380.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-381.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-382.md.snapis excluded by!**/*.snapand included by**
📒 Files selected for processing (39)
crates/biome_configuration/Cargo.tomlcrates/biome_configuration/src/lib.rscrates/biome_configuration/src/markdown.rscrates/biome_css_formatter/src/lib.rscrates/biome_markdown_factory/src/lib.rscrates/biome_markdown_formatter/Cargo.tomlcrates/biome_markdown_formatter/src/comments.rscrates/biome_markdown_formatter/src/context.rscrates/biome_markdown_formatter/src/cst.rscrates/biome_markdown_formatter/src/generated.rscrates/biome_markdown_formatter/src/lib.rscrates/biome_markdown_formatter/src/markdown/any/block.rscrates/biome_markdown_formatter/src/markdown/any/bullet_list_member.rscrates/biome_markdown_formatter/src/markdown/any/code_block.rscrates/biome_markdown_formatter/src/markdown/any/container_block.rscrates/biome_markdown_formatter/src/markdown/any/inline.rscrates/biome_markdown_formatter/src/markdown/any/leaf_block.rscrates/biome_markdown_formatter/src/markdown/auxiliary/document.rscrates/biome_markdown_formatter/src/markdown/auxiliary/hard_line.rscrates/biome_markdown_formatter/src/markdown/auxiliary/hash.rscrates/biome_markdown_formatter/src/markdown/auxiliary/header.rscrates/biome_markdown_formatter/src/markdown/auxiliary/paragraph.rscrates/biome_markdown_formatter/src/markdown/auxiliary/textual.rscrates/biome_markdown_formatter/src/markdown/lists/block_list.rscrates/biome_markdown_formatter/src/markdown/lists/bullet_list.rscrates/biome_markdown_formatter/src/markdown/lists/code_name_list.rscrates/biome_markdown_formatter/src/markdown/lists/hash_list.rscrates/biome_markdown_formatter/src/markdown/lists/indent_token_list.rscrates/biome_markdown_formatter/src/markdown/lists/inline_item_list.rscrates/biome_markdown_formatter/src/markdown/lists/quote_indent_list.rscrates/biome_markdown_formatter/src/prelude.rscrates/biome_markdown_formatter/src/trivia.rscrates/biome_markdown_formatter/src/verbatim.rscrates/biome_markdown_formatter/tests/language.rscrates/biome_markdown_formatter/tests/prettier_tests.rscrates/biome_markdown_formatter/tests/quick_test.rscrates/biome_markdown_formatter/tests/spec_test.rscrates/biome_markdown_formatter/tests/spec_tests.rscrates/biome_markdown_formatter/tests/specs/markdown/headers.md
crates/biome_markdown_formatter/src/markdown/auxiliary/hard_line.rs
Outdated
Show resolved
Hide resolved
tidefield
left a comment
There was a problem hiding this comment.
Thanks for filling in the gaps I missed
| @@ -0,0 +1,48 @@ | |||
| --- | |||
There was a problem hiding this comment.
Was this newly coming from prettier repo? I wonder why I didn't have it in the first place.
There was a problem hiding this comment.
Probably you're still using an old version of insta.
This is a guess, but I think insta starts emitting diagnostics for each snapshots and eventually gives up in there are too many.
FYI try to update the tools (there's a justfile task)
| -456 | ||
| +123456 | ||
|
|
||
| -123\ |
There was a problem hiding this comment.
I think if what you had for hardline is correct, then we shouldn't have the diff here.
There was a problem hiding this comment.
If I'm reading the snapshot correctly, the backlash is removed. If a user actually relies on that for a hard break, is there a way for the formatter to preserve the backslash intent? https://commonmark.org/help/tutorial/03-paragraphs.html
If we swallow \ without inserting one more new line, the rendered output in HTML will be
123456
where the two lines join together. This changes the document intent.
In other words, when someone writes
123\
456they expect the rendered output to be
123
456
With
123
456the lines join together in rendered output.
There was a problem hiding this comment.
Yeah we can fix that later. I was more focused on making the tests pass (idempotence check), and implementing something simple enough
The infrastructure we have is solid. Once we match prettier formatting, the snapshot is automatically deleted. The more we delete, the better
There was a problem hiding this comment.
Ok sounds good then. I just wanted to clarify my understanding.
There was a problem hiding this comment.
Yes you're understanding is correct!
Not sure if you checked my latest changes, you might have noticed how we passed down some options.
I believe we will have to rely on them a lot.
crates/biome_markdown_formatter/src/markdown/auxiliary/hard_line.rs
Outdated
Show resolved
Hide resolved
crates/biome_markdown_formatter/src/markdown/auxiliary/hard_line.rs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
crates/biome_markdown_formatter/tests/quick_test.rs (1)
13-23: This is currently a debug probe, not a test — make that explicit.Given it’s
#[ignore]and assertion-free, that’s fine for local probing; just switch debug prints todbg!per repo convention (or add assertions if you want this to catch regressions).Suggested tweak
- // Print CST - eprintln!("{:#?}", parse.syntax()); + dbg!(parse.syntax()); @@ - // Print formatted output let formatted = result.unwrap(); - eprintln!("Formatted:\n{}", formatted.print().unwrap().as_code()); + dbg!(formatted.print().unwrap().as_code());As per coding guidelines:
**/*.rs: Use thedbg!()macro for debugging output in Rust tests and code.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@crates/biome_markdown_formatter/tests/quick_test.rs` around lines 13 - 23, The test is only a debug probe and uses eprintln! for output; replace the debug prints with dbg! per repo convention or add assertions to make it a real test. Specifically, change the eprintln!("{:#?}", parse.syntax()) to dbg!(parse.syntax()), and replace eprintln!("Formatted:\n{}", formatted.print().unwrap().as_code()) with dbg!(formatted.print().unwrap().as_code()); keep the existing setup using MdFormatOptions::default(), biome_formatter::format_node(&parse.syntax(), MdFormatLanguage::new(options), false), and the formatted/result unwrap logic unchanged.
🤖 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_formatter/src/markdown/auxiliary/textual.rs`:
- Around line 6-24: Add inline rustdoc comments for the new formatting rule and
its options: place /// doc comments above the FormatMdTextual struct describing
its purpose (a formatting rule for MdTextual nodes) and behavior, and above the
FormatMdTextualOptions struct describing what the options control; also document
the should_remove option (what true/false does) next to its declaration and add
a short note on fmt_fields (or the rule's formatting behavior) so consumers
understand how the rule operates.
In `@crates/biome_markdown_formatter/src/markdown/lists/inline_item_list.rs`:
- Around line 41-43: When handling ordinary textual nodes in inline_item_list.rs
(the branch that calls joiner.entry(&text.format())), reset the seen_new_line
flag so subsequent empty text nodes aren't misclassified as post-newline; locate
the variable named seen_new_line and set it to false immediately after
joiner.entry(&text.format()) inside the same branch, ensuring the newline state
reflects that real text was emitted.
- Around line 45-47: AnyMdInline::MdHardLine is currently handled by the generic
branch (calling joiner.entry(&item.format())) which omits emitting the explicit
hard-line break; update the match in inline_item_list.rs to add an explicit arm
for AnyMdInline::MdHardLine that calls the hard_line_break() helper in addition
to formatting the node (i.e., invoke item.format() via joiner.entry or
equivalent and then call hard_line_break()), so callers align with
FormatMdHardLine::fmt_fields which strips the backslash token and expects the
caller to emit the break.
---
Nitpick comments:
In `@crates/biome_markdown_formatter/tests/quick_test.rs`:
- Around line 13-23: The test is only a debug probe and uses eprintln! for
output; replace the debug prints with dbg! per repo convention or add assertions
to make it a real test. Specifically, change the eprintln!("{:#?}",
parse.syntax()) to dbg!(parse.syntax()), and replace eprintln!("Formatted:\n{}",
formatted.print().unwrap().as_code()) with
dbg!(formatted.print().unwrap().as_code()); keep the existing setup using
MdFormatOptions::default(), biome_formatter::format_node(&parse.syntax(),
MdFormatLanguage::new(options), false), and the formatted/result unwrap logic
unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 5dfc377a-e77d-4bc9-88e0-5f1cd4b718db
⛔ Files ignored due to path filters (10)
crates/biome_markdown_formatter/tests/specs/prettier/markdown/break/simple.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/break/wrap.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/footnoteDefinition/long.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/footnoteDefinition/sibling.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/math/remark-math.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-17.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-182.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-183.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-186.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-289.md.snapis excluded by!**/*.snapand included by**
📒 Files selected for processing (11)
crates/biome_markdown_formatter/src/comments.rscrates/biome_markdown_formatter/src/context.rscrates/biome_markdown_formatter/src/cst.rscrates/biome_markdown_formatter/src/lib.rscrates/biome_markdown_formatter/src/markdown/auxiliary/hard_line.rscrates/biome_markdown_formatter/src/markdown/auxiliary/textual.rscrates/biome_markdown_formatter/src/markdown/lists/inline_item_list.rscrates/biome_markdown_formatter/src/trivia.rscrates/biome_markdown_formatter/src/verbatim.rscrates/biome_markdown_formatter/tests/language.rscrates/biome_markdown_formatter/tests/quick_test.rs
🚧 Files skipped from review as they are similar to previous changes (5)
- crates/biome_markdown_formatter/src/markdown/auxiliary/hard_line.rs
- crates/biome_markdown_formatter/tests/language.rs
- crates/biome_markdown_formatter/src/verbatim.rs
- crates/biome_markdown_formatter/src/context.rs
- crates/biome_markdown_formatter/src/cst.rs
d460097 to
5469bb9
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
crates/biome_markdown_formatter/src/context.rs (1)
120-129:⚠️ Potential issue | 🟠 MajorReturn the stored source map instead of always
None.At Line 128,
source_map()discards context state and always returnsNone. That makeswith_source_mapineffective and drops mappings.Suggested patch
impl FormatContext for MdFormatContext { type Options = MdFormatOptions; fn options(&self) -> &Self::Options { &self.options } fn source_map(&self) -> Option<&TransformSourceMap> { - None + self.source_map.as_ref() } }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@crates/biome_markdown_formatter/src/context.rs` around lines 120 - 129, The source_map() impl in MdFormatContext currently always returns None, discarding the stored TransformSourceMap and breaking with_source_map; change source_map() to return a reference to the stored map (e.g., self.source_map.as_ref()) instead of None so the context exposes its internal TransformSourceMap; locate MdFormatContext and update its source_map(&self) -> Option<&TransformSourceMap> to return the stored option rather than None.
♻️ Duplicate comments (1)
crates/biome_markdown_formatter/src/markdown/lists/inline_item_list.rs (1)
45-50:⚠️ Potential issue | 🟡 MinorReset newline state after emitting normal text.
At Line 46, regular textual content is emitted, but
seen_new_linestays unchanged. If it wastrue, later empty text can be treated as post-newline incorrectly.Suggested patch
} else { joiner.entry(&text.format().with_options(FormatMdTextualOptions { should_remove: false, trime_start: self.trime_start && index == 0, })); + seen_new_line = false; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@crates/biome_markdown_formatter/src/markdown/lists/inline_item_list.rs` around lines 45 - 50, When emitting regular textual content inside the else branch that calls joiner.entry(&text.format().with_options(FormatMdTextualOptions { ... })), reset the newline state so subsequent empty text isn't misclassified; specifically, after the joiner.entry(...) call set the seen_new_line flag (seen_new_line or self.seen_new_line used in this module) to false so normal text clears the post-newline state. Locate the else branch around the joiner.entry invocation in inline_item_list.rs and add a statement to reset seen_new_line immediately after emitting the formatted text.
🧹 Nitpick comments (3)
crates/biome_markdown_formatter/src/markdown/lists/inline_item_list.rs (1)
63-65: Consider renamingtrime_starttotrim_startbefore this spreads further.Line 64’s typo is harmless functionally, but it makes APIs harder to scan and grep over time.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@crates/biome_markdown_formatter/src/markdown/lists/inline_item_list.rs` around lines 63 - 65, The struct field name `trime_start` in FormatMdFormatInlineItemListOptions is a typo; rename it to `trim_start` (keeping pub(crate) visibility) and update all usages (constructors, struct literals, field accesses, and pattern matches) to the new name so compilation succeeds; search for the exact identifier `trime_start` and replace it with `trim_start` across the crate to avoid breaking references.crates/biome_markdown_formatter/src/generated.rs (1)
863-864: Please re-run generation/formatting for this generated block.Line 863 and Line 872 have atypical token spacing in this generated file. It compiles, but it looks like a non-clean codegen/format pass and will create noisy future diffs.
Suggested tidy-up
- FormatRefWithRule :: new (self , crate :: markdown :: auxiliary :: link_reference_definition :: FormatMdLinkReferenceDefinition :: default ()) + FormatRefWithRule::new( + self, + crate::markdown::auxiliary::link_reference_definition::FormatMdLinkReferenceDefinition::default(), + ) - FormatOwnedWithRule :: new (self , crate :: markdown :: auxiliary :: link_reference_definition :: FormatMdLinkReferenceDefinition :: default ()) + FormatOwnedWithRule::new( + self, + crate::markdown::auxiliary::link_reference_definition::FormatMdLinkReferenceDefinition::default(), + )As per coding guidelines
**/*_formatter/**/*.rs: "Runjust gen-formatter <lang>before opening a PR when implementing changes to formatter in*_formatterdirectories" and**/*.rs: "Always runjust f(code formatting) andjust l(linting) before committing code".Also applies to: 872-873
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@crates/biome_markdown_formatter/src/generated.rs` around lines 863 - 864, The generated block has inconsistent token spacing around the constructor call for FormatRefWithRule::new and the nested FormatMdLinkReferenceDefinition::default() invocation; re-run the formatter/generator to normalize spacing by regenerating this formatter code (run the generation step used for this project, e.g., just gen-formatter for the language) and then run code formatting and linting (just f and just l) so the line with FormatRefWithRule::new(self, crate::markdown::auxiliary::link_reference_definition::FormatMdLinkReferenceDefinition::default()) and the related lines are rewritten with canonical spacing.crates/biome_configuration/src/markdown.rs (1)
61-67: Optional consistency note: addoptionalto these two fields for clarity.Both
trailing_newlineandline_endingalready work fine as optional (bpaf infers it fromOption<T>), but the other formatter flags explicitly includeoptional. Adding it here makes the intent clearer and matches the pattern used elsewhere in the struct.Consistency tweak
- #[bpaf(long("md-formatter-trailing-newline"), argument("true|false"))] + #[bpaf(long("md-formatter-trailing-newline"), argument("true|false"), optional)] #[serde(skip_serializing_if = "Option::is_none")] pub trailing_newline: Option<TrailingNewline>, - #[bpaf(long("md-formatter-line-ending"), argument("lf|crlf|cr|auto"))] + #[bpaf(long("md-formatter-line-ending"), argument("lf|crlf|cr|auto"), optional)] #[serde(skip_serializing_if = "Option::is_none")] pub line_ending: Option<LineEnding>,🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@crates/biome_configuration/src/markdown.rs` around lines 61 - 67, Add the bpaf attribute flag `optional` to the md formatter fields so their intent as optional CLI flags is explicit: update the attributes on the struct fields `trailing_newline` and `line_ending` (currently annotated with #[bpaf(long("md-formatter-trailing-newline"), argument("true|false"))] and #[bpaf(long("md-formatter-line-ending"), argument("lf|crlf|cr|auto"))]) to include optional (e.g. #[bpaf(long(...), argument(...), optional)]), matching the pattern used by other formatter flags.
🤖 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_formatter/src/cst.rs`:
- Around line 11-34: Delete the duplicate impl block implementing
FormatRule<MarkdownSyntaxToken> for FormatMarkdownSyntaxNode (the impl that
defines fn fmt calling track_token and the two format_*_trivia methods); token
formatting is already implemented by FormatMdSyntaxToken in lib.rs, and
FormatMarkdownSyntaxNode should only implement FormatRule<MarkdownSyntaxNode>
(the existing map_syntax_node! implementation). Keep the impl
FormatToken<MarkdownLanguage, MdFormatContext> for FormatMarkdownSyntaxNode if
present, and remove only the redundant FormatRule<MarkdownSyntaxToken> impl to
avoid coherence/compilation errors.
---
Outside diff comments:
In `@crates/biome_markdown_formatter/src/context.rs`:
- Around line 120-129: The source_map() impl in MdFormatContext currently always
returns None, discarding the stored TransformSourceMap and breaking
with_source_map; change source_map() to return a reference to the stored map
(e.g., self.source_map.as_ref()) instead of None so the context exposes its
internal TransformSourceMap; locate MdFormatContext and update its
source_map(&self) -> Option<&TransformSourceMap> to return the stored option
rather than None.
---
Duplicate comments:
In `@crates/biome_markdown_formatter/src/markdown/lists/inline_item_list.rs`:
- Around line 45-50: When emitting regular textual content inside the else
branch that calls
joiner.entry(&text.format().with_options(FormatMdTextualOptions { ... })), reset
the newline state so subsequent empty text isn't misclassified; specifically,
after the joiner.entry(...) call set the seen_new_line flag (seen_new_line or
self.seen_new_line used in this module) to false so normal text clears the
post-newline state. Locate the else branch around the joiner.entry invocation in
inline_item_list.rs and add a statement to reset seen_new_line immediately after
emitting the formatted text.
---
Nitpick comments:
In `@crates/biome_configuration/src/markdown.rs`:
- Around line 61-67: Add the bpaf attribute flag `optional` to the md formatter
fields so their intent as optional CLI flags is explicit: update the attributes
on the struct fields `trailing_newline` and `line_ending` (currently annotated
with #[bpaf(long("md-formatter-trailing-newline"), argument("true|false"))] and
#[bpaf(long("md-formatter-line-ending"), argument("lf|crlf|cr|auto"))]) to
include optional (e.g. #[bpaf(long(...), argument(...), optional)]), matching
the pattern used by other formatter flags.
In `@crates/biome_markdown_formatter/src/generated.rs`:
- Around line 863-864: The generated block has inconsistent token spacing around
the constructor call for FormatRefWithRule::new and the nested
FormatMdLinkReferenceDefinition::default() invocation; re-run the
formatter/generator to normalize spacing by regenerating this formatter code
(run the generation step used for this project, e.g., just gen-formatter for the
language) and then run code formatting and linting (just f and just l) so the
line with FormatRefWithRule::new(self,
crate::markdown::auxiliary::link_reference_definition::FormatMdLinkReferenceDefinition::default())
and the related lines are rewritten with canonical spacing.
In `@crates/biome_markdown_formatter/src/markdown/lists/inline_item_list.rs`:
- Around line 63-65: The struct field name `trime_start` in
FormatMdFormatInlineItemListOptions is a typo; rename it to `trim_start`
(keeping pub(crate) visibility) and update all usages (constructors, struct
literals, field accesses, and pattern matches) to the new name so compilation
succeeds; search for the exact identifier `trime_start` and replace it with
`trim_start` across the crate to avoid breaking references.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 760929c6-677e-4a7f-86a0-6a2dd427a050
⛔ Files ignored due to path filters (75)
crates/biome_markdown_formatter/tests/specs/markdown/headers.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/blockquote/code.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/blockquote/ignore-code.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/blockquote/nested.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/blockquote/notext-end.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/break/simple.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/break/wrap.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/broken-plugins/missing-comments.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/0-indent-js.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/additional-space.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/angular/angular-html.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/angular/angular-ts.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/backtick.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/indent.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-auth-api.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-background-1.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-background-2.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-background-3.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-background-4.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-background-5.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-background-6.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-background-7.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-background-8.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-background-9.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-filter-1.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-filter-2.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-font-face-1.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-font-face-2.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-grid-auto-columns.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-import.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-mask-image.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-padding-1.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-padding-2.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-transform.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-unicode-range.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/cursor/17227.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/emphasis/asterisk.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/emphasis/complex.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/emphasis/special.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/footnoteDefinition/long.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/footnoteDefinition/multiline.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/footnoteDefinition/sibling.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/front-matter/custom-parser.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/front-matter/empty.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/heading/setext.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/html/multiline-with-trailing-space.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/html/multiline.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/ignore/top-level-range.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/indentation/example.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/inlineCode/backtick.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/link/encodedLink.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/link/title.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/linkReference/case-and-space/case-and-space.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/linkReference/case-and-space/issue-7118.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/linkReference/definition.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/linkReference/title.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/liquid/unbalanced-mismatched-braces.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/liquid/unbalanced-object-close-only.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/liquid/unbalanced-object-open-only.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/liquid/unbalanced-template-close-only.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/liquid/unbalanced-template-open-only.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/align.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/codeblock.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/combined-lists.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/git-diff-friendly.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/indent.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/interrupt.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/issue-17652.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/issue-7846.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/loose.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/nested-checkbox.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/nested-tab.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/start.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/tab.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/unordered.md.snapis excluded by!**/*.snapand included by**
📒 Files selected for processing (38)
crates/biome_configuration/Cargo.tomlcrates/biome_configuration/src/lib.rscrates/biome_configuration/src/markdown.rscrates/biome_css_formatter/src/lib.rscrates/biome_markdown_formatter/Cargo.tomlcrates/biome_markdown_formatter/src/comments.rscrates/biome_markdown_formatter/src/context.rscrates/biome_markdown_formatter/src/cst.rscrates/biome_markdown_formatter/src/generated.rscrates/biome_markdown_formatter/src/lib.rscrates/biome_markdown_formatter/src/markdown/any/block.rscrates/biome_markdown_formatter/src/markdown/any/bullet_list_member.rscrates/biome_markdown_formatter/src/markdown/any/code_block.rscrates/biome_markdown_formatter/src/markdown/any/container_block.rscrates/biome_markdown_formatter/src/markdown/any/inline.rscrates/biome_markdown_formatter/src/markdown/any/leaf_block.rscrates/biome_markdown_formatter/src/markdown/auxiliary/document.rscrates/biome_markdown_formatter/src/markdown/auxiliary/hard_line.rscrates/biome_markdown_formatter/src/markdown/auxiliary/hash.rscrates/biome_markdown_formatter/src/markdown/auxiliary/header.rscrates/biome_markdown_formatter/src/markdown/auxiliary/paragraph.rscrates/biome_markdown_formatter/src/markdown/auxiliary/textual.rscrates/biome_markdown_formatter/src/markdown/lists/block_list.rscrates/biome_markdown_formatter/src/markdown/lists/bullet_list.rscrates/biome_markdown_formatter/src/markdown/lists/code_name_list.rscrates/biome_markdown_formatter/src/markdown/lists/hash_list.rscrates/biome_markdown_formatter/src/markdown/lists/indent_token_list.rscrates/biome_markdown_formatter/src/markdown/lists/inline_item_list.rscrates/biome_markdown_formatter/src/markdown/lists/quote_indent_list.rscrates/biome_markdown_formatter/src/prelude.rscrates/biome_markdown_formatter/src/trivia.rscrates/biome_markdown_formatter/src/verbatim.rscrates/biome_markdown_formatter/tests/language.rscrates/biome_markdown_formatter/tests/prettier_tests.rscrates/biome_markdown_formatter/tests/quick_test.rscrates/biome_markdown_formatter/tests/spec_test.rscrates/biome_markdown_formatter/tests/spec_tests.rscrates/biome_markdown_formatter/tests/specs/markdown/headers.md
🚧 Files skipped from review as they are similar to previous changes (18)
- crates/biome_markdown_formatter/src/markdown/lists/hash_list.rs
- crates/biome_markdown_formatter/src/markdown/any/block.rs
- crates/biome_markdown_formatter/src/markdown/auxiliary/hash.rs
- crates/biome_css_formatter/src/lib.rs
- crates/biome_markdown_formatter/src/markdown/lists/bullet_list.rs
- crates/biome_markdown_formatter/src/markdown/any/code_block.rs
- crates/biome_markdown_formatter/tests/prettier_tests.rs
- crates/biome_markdown_formatter/tests/spec_test.rs
- crates/biome_markdown_formatter/src/verbatim.rs
- crates/biome_markdown_formatter/src/markdown/lists/quote_indent_list.rs
- crates/biome_markdown_formatter/src/markdown/lists/block_list.rs
- crates/biome_markdown_formatter/src/comments.rs
- crates/biome_markdown_formatter/tests/specs/markdown/headers.md
- crates/biome_markdown_formatter/tests/spec_tests.rs
- crates/biome_markdown_formatter/src/markdown/any/container_block.rs
- crates/biome_markdown_formatter/src/trivia.rs
- crates/biome_configuration/src/lib.rs
- crates/biome_markdown_formatter/src/markdown/auxiliary/textual.rs
There was a problem hiding this comment.
🧹 Nitpick comments (1)
crates/biome_configuration/src/markdown.rs (1)
32-94: Consider one regression snapshot for CLI visibility.Given this PR’s goal, a small CLI snapshot test asserting the intended
md-formatter-*surface would keep this plumbing future-proof (and save future-you a Friday surprise).🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@crates/biome_configuration/src/markdown.rs` around lines 32 - 94, Add a small CLI snapshot test that verifies the bpaf/CLI exposes the md-formatter-* flags (md-formatter-enabled, md-formatter-indent-style, md-formatter-indent-width, md-formatter-line-width, md-formatter-trailing-newline, md-formatter-line-ending) so future changes to the Markdown config fields (enabled, indent_style, indent_width, line_width, trailing_newline, line_ending in markdown.rs) don't regress the CLI surface; implement the test to render the CLI help/usage output for the crate's argument parser (or the bpaf parser that wires these fields) and assert it matches a committed snapshot string. Ensure the test is gated behind the same feature if needed (feature = "markdown") and placed with other CLI tests so CI will catch any accidental removal or renaming of those flags.
🤖 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_configuration/src/markdown.rs`:
- Around line 32-94: Add a small CLI snapshot test that verifies the bpaf/CLI
exposes the md-formatter-* flags (md-formatter-enabled,
md-formatter-indent-style, md-formatter-indent-width, md-formatter-line-width,
md-formatter-trailing-newline, md-formatter-line-ending) so future changes to
the Markdown config fields (enabled, indent_style, indent_width, line_width,
trailing_newline, line_ending in markdown.rs) don't regress the CLI surface;
implement the test to render the CLI help/usage output for the crate's argument
parser (or the bpaf parser that wires these fields) and assert it matches a
committed snapshot string. Ensure the test is gated behind the same feature if
needed (feature = "markdown") and placed with other CLI tests so CI will catch
any accidental removal or renaming of those flags.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: f3d24e9a-b8ff-4686-98d6-92d95d74d71d
📒 Files selected for processing (1)
crates/biome_configuration/src/markdown.rs
| -456 | ||
| +123456 | ||
|
|
||
| -123\ |
There was a problem hiding this comment.
If I'm reading the snapshot correctly, the backlash is removed. If a user actually relies on that for a hard break, is there a way for the formatter to preserve the backslash intent? https://commonmark.org/help/tutorial/03-paragraphs.html
If we swallow \ without inserting one more new line, the rendered output in HTML will be
123456
where the two lines join together. This changes the document intent.
In other words, when someone writes
123\
456they expect the rendered output to be
123
456
With
123
456the lines join together in rendered output.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
8d7ef7f to
4984597
Compare
Summary
Part of #3718
This PR finishes the plumbing of the markdown formatter. What's been changed
MarkdownLanguage->MdLanguage, like JSbiome_service/biome_configuration-> featuremarkdown. With this, we can use markdown without exposing things to the userAdded formatting for headers, so that we can start seeing some formatting and usage.
To notice the formatting of
MdHardLine, which is formatted withformat_removedand then by formatting withhard_line_breakcc @tidefield
Test Plan
Added new test, updated the snapshots.
Docs