feat(md/fmt): better formatting for some cases#9917
Conversation
|
1703add to
2bd35ff
Compare
WalkthroughThis PR makes targeted formatting and parsing changes in the Markdown formatter and lexer: block and inline block lists now support a trim option and propagate trim behaviour to newline formatting; a new TrimMode::AutoLinkLike and a TextPrintMode predicate enable angle-bracket auto-link-like trimming; several auxiliary formatters (inline-image destination, inline-italic, reference-image, reference-link-label, quote-prefix) were rewritten to use structural field formatting or adjusted to preserve original syntax in specific ancestors; the newline formatter gained options to emit removed tokens conditionally; the lexer’s hard-line-break detection now treats trailing spaces at end-of-input as a potential hard break. Tests were added/expanded for inline images, italics, links and top-of-file newlines. Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Parser conformance results onjs/262
jsx/babel
markdown/commonmark
symbols/microsoft
ts/babel
ts/microsoft
|
Merging this PR will not alter performance
Comparing Footnotes
|
2bd35ff to
2e73ebb
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (3)
crates/biome_markdown_formatter/tests/quick_test.rs (1)
24-32: Consider asserting idempotence, not just printing it.You already do the second pass — adding an equality assertion would turn this from a debug helper into a guardrail. Logs are charming; assertions are loyal.
Possible follow-up tweak
- let output2 = result2.unwrap(); - eprintln!("Re-formatted:\n{}", output2.print().unwrap().as_code()); + let output2 = result2.unwrap().print().unwrap(); + eprintln!("Re-formatted:\n{}", output2.as_code()); + assert_eq!(output.as_code(), output2.as_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 24 - 32, Add an assertion to enforce idempotence by comparing the first-format result with the second-format result instead of only printing them: after computing output (from format_node -> output.print().as_code()) and output2 (from second format_node -> output2.print().as_code()), assert they are equal (or assert their printed strings are equal) so the test fails if formatting isn't stable; reference the existing variables and functions parse_markdown, reparse.syntax(), biome_formatter::format_node, output, output2, and their .print().as_code() results when adding the equality check.crates/biome_markdown_parser/src/lexer/mod.rs (1)
1210-1233: Doc contract is now slightly stale.
is_potential_hard_line_breaknow returnstruefor EOF as well, but the doc still says “followed by a newline”. Worth aligning to avoid future surprises.Suggested doc tweak
- /// Returns true if there are 2+ spaces followed by a newline. + /// Returns true if there are 2+ spaces followed by a newline, + /// or EOF (to split trailing spaces from preceding text).🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@crates/biome_markdown_parser/src/lexer/mod.rs` around lines 1210 - 1233, The doc comment for is_potential_hard_line_break is stale: the function treats EOF (trailing spaces at end-of-file) as a valid "potential hard line break" and returns true for EOF as well as newline/CR, but the comment still says "followed by a newline". Update the doc comment on fn is_potential_hard_line_break to state that it returns true for 2+ spaces followed by a newline, CR, or EOF (to reflect the special-case behavior for trailing spaces), and keep the existing explanation about splitting trailing spaces for formatter/idempotency.crates/biome_markdown_formatter/tests/specs/markdown/newline.md (1)
1-6: Useful test, but add the exact#9481shape too.This covers leading-newline trimming well. I’d also add a case with a hard-line marker immediately followed by an empty line, so the regression is pinned directly (and future maintainers sleep better).
As per coding guidelines: "All code changes MUST include appropriate tests ... and bug fixes require tests that reproduce and validate the fix."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@crates/biome_markdown_formatter/tests/specs/markdown/newline.md` around lines 1 - 6, Add a second test case to the existing newline.md spec that reproduces the exact `#9481` shape: include a content block starting with a hard-line marker (a line that ends with the Markdown hard line-break marker, e.g., two trailing spaces) immediately followed by an empty line, then the header text; ensure this file (crates/biome_markdown_formatter/tests/specs/markdown/newline.md) contains both the original leading-newline trimming case and the new hard-line+empty-line case so the formatter's handling of a hard-line marker followed by a blank line is explicitly tested.
🤖 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/lists/inline_item_list.rs`:
- Around line 103-126: The current auto-link detection inspects raw first/last
inline items, so wrap detection should instead find the first and last non-empty
items before testing for '<' and '>' to avoid missing links wrapped in
surrounding whitespace; change the logic that builds items and computes
starts_with_lt / ends_with_gt to locate the first/last non-empty AnyMdInline
(ignoring whitespace/textual tokens that are trimmed) and test those with
AnyMdInline::MdTextual and value_token().is_ok_and(|tok| tok.text() == "<" /
">") to set is_auto_link, leaving the rest of the branch (calling
fmt_trim_all(node, f) when not auto-link and the joiner entry behavior) intact.
In `@crates/biome_markdown_formatter/src/shared.rs`:
- Around line 38-40: Fix the tiny typo in the TrimMode::AutoLinkLike doc
comment: change the phrase "If no link has been detected, if falls back to
[Self::All]" to "If no link has been detected, it falls back to [Self::All]" in
the TrimMode::AutoLinkLike documentation string so the wording is correct.
---
Nitpick comments:
In `@crates/biome_markdown_formatter/tests/quick_test.rs`:
- Around line 24-32: Add an assertion to enforce idempotence by comparing the
first-format result with the second-format result instead of only printing them:
after computing output (from format_node -> output.print().as_code()) and
output2 (from second format_node -> output2.print().as_code()), assert they are
equal (or assert their printed strings are equal) so the test fails if
formatting isn't stable; reference the existing variables and functions
parse_markdown, reparse.syntax(), biome_formatter::format_node, output, output2,
and their .print().as_code() results when adding the equality check.
In `@crates/biome_markdown_formatter/tests/specs/markdown/newline.md`:
- Around line 1-6: Add a second test case to the existing newline.md spec that
reproduces the exact `#9481` shape: include a content block starting with a
hard-line marker (a line that ends with the Markdown hard line-break marker,
e.g., two trailing spaces) immediately followed by an empty line, then the
header text; ensure this file
(crates/biome_markdown_formatter/tests/specs/markdown/newline.md) contains both
the original leading-newline trimming case and the new hard-line+empty-line case
so the formatter's handling of a hard-line marker followed by a blank line is
explicitly tested.
In `@crates/biome_markdown_parser/src/lexer/mod.rs`:
- Around line 1210-1233: The doc comment for is_potential_hard_line_break is
stale: the function treats EOF (trailing spaces at end-of-file) as a valid
"potential hard line break" and returns true for EOF as well as newline/CR, but
the comment still says "followed by a newline". Update the doc comment on fn
is_potential_hard_line_break to state that it returns true for 2+ spaces
followed by a newline, CR, or EOF (to reflect the special-case behavior for
trailing spaces), and keep the existing explanation about splitting trailing
spaces for formatter/idempotency.
🪄 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: 302d9516-10db-4df1-8a6c-7602a8e25717
⛔ Files ignored due to path filters (55)
crates/biome_markdown_formatter/tests/specs/markdown/blockquote.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/markdown/hard_line.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/markdown/inline_image.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/markdown/inline_italic.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/markdown/inline_links.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/markdown/newline.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/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/code/additional-space.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/link/encodedLink.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/combined-lists.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/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/multiparser-json/invalid-json.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-187.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-211.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-48.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-543.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-65.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-85.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/table/issue-15572.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/wiki-link/extra-brackets-leading.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/wiki-link/extra-brackets-trailing.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/wiki-link/extra-brackets.md.snapis excluded by!**/*.snapand included by**
📒 Files selected for processing (16)
crates/biome_markdown_formatter/src/markdown/auxiliary/document.rscrates/biome_markdown_formatter/src/markdown/auxiliary/inline_image.rscrates/biome_markdown_formatter/src/markdown/auxiliary/inline_italic.rscrates/biome_markdown_formatter/src/markdown/auxiliary/newline.rscrates/biome_markdown_formatter/src/markdown/auxiliary/quote_prefix.rscrates/biome_markdown_formatter/src/markdown/auxiliary/reference_image.rscrates/biome_markdown_formatter/src/markdown/auxiliary/reference_link_label.rscrates/biome_markdown_formatter/src/markdown/lists/block_list.rscrates/biome_markdown_formatter/src/markdown/lists/inline_item_list.rscrates/biome_markdown_formatter/src/shared.rscrates/biome_markdown_formatter/tests/quick_test.rscrates/biome_markdown_formatter/tests/specs/markdown/inline_image.mdcrates/biome_markdown_formatter/tests/specs/markdown/inline_italic.mdcrates/biome_markdown_formatter/tests/specs/markdown/inline_links.mdcrates/biome_markdown_formatter/tests/specs/markdown/newline.mdcrates/biome_markdown_parser/src/lexer/mod.rs
There was a problem hiding this comment.
♻️ Duplicate comments (2)
crates/biome_markdown_formatter/src/shared.rs (1)
38-40:⚠️ Potential issue | 🟡 MinorFix the tiny doc typo in
TrimMode::AutoLinkLike.“if falls back” should be “it falls back”.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@crates/biome_markdown_formatter/src/shared.rs` around lines 38 - 40, Typo in the doc comment for the enum variant TrimMode::AutoLinkLike: change "if falls back to [Self::All]" to "it falls back to [Self::All]". Locate the TrimMode enum definition and update the docstring above the AutoLinkLike variant to replace "if" with "it" so the sentence reads correctly.crates/biome_markdown_formatter/src/markdown/lists/inline_item_list.rs (1)
105-126:⚠️ Potential issue | 🟠 MajorDetect and strip auto-link wrappers using first/last non-empty items.
Current logic checks raw list edges, so inputs like
( <https://example.com> )can miss the auto-link path and keep angle brackets. Use content boundaries for both detection and wrapper removal.Suggested fix
- let starts_with_lt = matches!(items.first(), Some(AnyMdInline::MdTextual(t)) if t.value_token().is_ok_and(|tok| tok.text() == "<")); - let ends_with_gt = matches!(items.last(), Some(AnyMdInline::MdTextual(t)) if t.value_token().is_ok_and(|tok| tok.text() == ">")); - - let is_auto_link = starts_with_lt && ends_with_gt && items.len() > 2; + let is_content = |item: &AnyMdInline| match item { + AnyMdInline::MdTextual(text) => !text.is_empty().unwrap_or_default(), + AnyMdInline::MdHardLine(_) => false, + _ => true, + }; + + let first_content = items.iter().position(&is_content); + let last_content = items.iter().rposition(is_content); + + let starts_with_lt = first_content + .and_then(|index| items.get(index)) + .is_some_and(|item| { + matches!(item, AnyMdInline::MdTextual(t) if t.value_token().is_ok_and(|tok| tok.text() == "<")) + }); + let ends_with_gt = last_content + .and_then(|index| items.get(index)) + .is_some_and(|item| { + matches!(item, AnyMdInline::MdTextual(t) if t.value_token().is_ok_and(|tok| tok.text() == ">")) + }); + + let Some((first_content, last_content)) = first_content.zip(last_content) else { + return self.fmt_trim_all(node, f); + }; + let is_auto_link = starts_with_lt && ends_with_gt && last_content > first_content + 1; @@ - for (index, item) in items.iter().enumerate() { - if (index == 0 || index == items.len() - 1) + for (index, item) in items.iter().enumerate() { + if (index == first_content || index == last_content) && let AnyMdInline::MdTextual(text) = item {🤖 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 105 - 126, The auto-link detection and removal currently use raw first/last list elements (starts_with_lt / ends_with_gt and is_auto_link) which fails when leading/trailing whitespace or wrapper nodes exist; update detection to find the first and last non-empty textual items (e.g., locate the first and last AnyMdInline::MdTextual whose value_token().is_ok_and(|tok| !tok.text().trim().is_empty())) and use those indices to set starts_with_lt / ends_with_gt and to decide is_auto_link; when building the output with joiner, skip or strip only those identified wrapper text nodes by index (instead of assuming items[0] and items[len-1]) and still call text.format().with_options(FormatMdTextualOptions { should_remove: true, ..Default::default() }) for the actual wrapper nodes, otherwise fall back to self.fmt_trim_all(node, f).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@crates/biome_markdown_formatter/src/markdown/lists/inline_item_list.rs`:
- Around line 105-126: The auto-link detection and removal currently use raw
first/last list elements (starts_with_lt / ends_with_gt and is_auto_link) which
fails when leading/trailing whitespace or wrapper nodes exist; update detection
to find the first and last non-empty textual items (e.g., locate the first and
last AnyMdInline::MdTextual whose value_token().is_ok_and(|tok|
!tok.text().trim().is_empty())) and use those indices to set starts_with_lt /
ends_with_gt and to decide is_auto_link; when building the output with joiner,
skip or strip only those identified wrapper text nodes by index (instead of
assuming items[0] and items[len-1]) and still call
text.format().with_options(FormatMdTextualOptions { should_remove: true,
..Default::default() }) for the actual wrapper nodes, otherwise fall back to
self.fmt_trim_all(node, f).
In `@crates/biome_markdown_formatter/src/shared.rs`:
- Around line 38-40: Typo in the doc comment for the enum variant
TrimMode::AutoLinkLike: change "if falls back to [Self::All]" to "it falls back
to [Self::All]". Locate the TrimMode enum definition and update the docstring
above the AutoLinkLike variant to replace "if" with "it" so the sentence reads
correctly.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 06154209-009d-470e-9715-2f5c97eed2bc
⛔ Files ignored due to path filters (55)
crates/biome_markdown_formatter/tests/specs/markdown/blockquote.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/markdown/hard_line.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/markdown/inline_image.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/markdown/inline_italic.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/markdown/inline_links.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/markdown/newline.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/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/code/additional-space.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/link/encodedLink.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/combined-lists.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/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/multiparser-json/invalid-json.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-187.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-211.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-48.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-543.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-65.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-85.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/table/issue-15572.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/wiki-link/extra-brackets-leading.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/wiki-link/extra-brackets-trailing.md.snapis excluded by!**/*.snapand included by**crates/biome_markdown_formatter/tests/specs/prettier/markdown/wiki-link/extra-brackets.md.snapis excluded by!**/*.snapand included by**
📒 Files selected for processing (16)
crates/biome_markdown_formatter/src/markdown/auxiliary/document.rscrates/biome_markdown_formatter/src/markdown/auxiliary/inline_image.rscrates/biome_markdown_formatter/src/markdown/auxiliary/inline_italic.rscrates/biome_markdown_formatter/src/markdown/auxiliary/newline.rscrates/biome_markdown_formatter/src/markdown/auxiliary/quote_prefix.rscrates/biome_markdown_formatter/src/markdown/auxiliary/reference_image.rscrates/biome_markdown_formatter/src/markdown/auxiliary/reference_link_label.rscrates/biome_markdown_formatter/src/markdown/lists/block_list.rscrates/biome_markdown_formatter/src/markdown/lists/inline_item_list.rscrates/biome_markdown_formatter/src/shared.rscrates/biome_markdown_formatter/tests/quick_test.rscrates/biome_markdown_formatter/tests/specs/markdown/inline_image.mdcrates/biome_markdown_formatter/tests/specs/markdown/inline_italic.mdcrates/biome_markdown_formatter/tests/specs/markdown/inline_links.mdcrates/biome_markdown_formatter/tests/specs/markdown/newline.mdcrates/biome_markdown_parser/src/lexer/mod.rs
✅ Files skipped from review due to trivial changes (5)
- crates/biome_markdown_formatter/tests/specs/markdown/inline_links.md
- crates/biome_markdown_formatter/tests/specs/markdown/newline.md
- crates/biome_markdown_formatter/tests/quick_test.rs
- crates/biome_markdown_formatter/tests/specs/markdown/inline_image.md
- crates/biome_markdown_formatter/tests/specs/markdown/inline_italic.md
🚧 Files skipped from review as they are similar to previous changes (9)
- crates/biome_markdown_formatter/src/markdown/auxiliary/inline_image.rs
- crates/biome_markdown_formatter/src/markdown/auxiliary/quote_prefix.rs
- crates/biome_markdown_formatter/src/markdown/auxiliary/document.rs
- crates/biome_markdown_formatter/src/markdown/auxiliary/reference_link_label.rs
- crates/biome_markdown_parser/src/lexer/mod.rs
- crates/biome_markdown_formatter/src/markdown/auxiliary/reference_image.rs
- crates/biome_markdown_formatter/src/markdown/auxiliary/inline_italic.rs
- crates/biome_markdown_formatter/src/markdown/lists/block_list.rs
- crates/biome_markdown_formatter/src/markdown/auxiliary/newline.rs
dyc3
left a comment
There was a problem hiding this comment.
Nice progress on the prettier snapshots
Summary
Closes #9481
This improves MD formatting in various areas:
Test Plan
Many prettier tests have been deleted.
Added new tests
Docs