diff --git a/crates/biome_markdown_formatter/src/markdown/auxiliary/bullet.rs b/crates/biome_markdown_formatter/src/markdown/auxiliary/bullet.rs index cb6fb3097c04..d69e8386c06f 100644 --- a/crates/biome_markdown_formatter/src/markdown/auxiliary/bullet.rs +++ b/crates/biome_markdown_formatter/src/markdown/auxiliary/bullet.rs @@ -1,10 +1,52 @@ +use crate::markdown::auxiliary::list_marker_prefix::FormatMdListMarkerPrefixOptions; use crate::prelude::*; -use biome_markdown_syntax::MdBullet; -use biome_rowan::AstNode; +use biome_formatter::write; +use biome_markdown_syntax::{ + AnyMdBlock, AnyMdLeafBlock, MarkdownSyntaxKind, MdBullet, MdBulletFields, +}; #[derive(Debug, Clone, Default)] pub(crate) struct FormatMdBullet; impl FormatNodeRule for FormatMdBullet { fn fmt_fields(&self, node: &MdBullet, f: &mut MarkdownFormatter) -> FormatResult<()> { - format_verbatim_node(node.syntax()).fmt(f) + let MdBulletFields { prefix, content } = node.as_fields(); + + let prefix = prefix?; + let marker = prefix.marker()?; + + // `* - - -` is a bullet containing a `-` thematic break. Normalizing `*` + // to `-` produces `- - - -` which CommonMark 4.1 parses as a thematic + // break, not a list item. Same for `+ - - -`. Skip normalization for marker + // but still format content through child formatters. + let target_marker = if marker.kind() == MarkdownSyntaxKind::MINUS + || first_block_is_dash_thematic_break(&content) + { + None + } else { + Some("-") + }; + + write!( + f, + [prefix + .format() + .with_options(FormatMdListMarkerPrefixOptions { target_marker })] + )?; + content.format().fmt(f)?; + Ok(()) } } + +/// Returns true if the first block in `content` is a thematic break using `-`. +fn first_block_is_dash_thematic_break(content: &biome_markdown_syntax::MdBlockList) -> bool { + let Some(AnyMdBlock::AnyMdLeafBlock(AnyMdLeafBlock::MdThematicBreakBlock(block))) = + content.iter().next() + else { + return false; + }; + block + .parts() + .into_iter() + .find_map(|p| p.as_md_thematic_break_char().cloned()) + .and_then(|c| c.value().ok()) + .is_some_and(|t| t.text_trimmed() == "-") +} diff --git a/crates/biome_markdown_formatter/src/markdown/auxiliary/bullet_list_item.rs b/crates/biome_markdown_formatter/src/markdown/auxiliary/bullet_list_item.rs index 98de279ca827..fb19d76e01bd 100644 --- a/crates/biome_markdown_formatter/src/markdown/auxiliary/bullet_list_item.rs +++ b/crates/biome_markdown_formatter/src/markdown/auxiliary/bullet_list_item.rs @@ -1,10 +1,11 @@ use crate::prelude::*; -use biome_markdown_syntax::MdBulletListItem; -use biome_rowan::AstNode; +use biome_formatter::write; +use biome_markdown_syntax::{MdBulletListItem, MdBulletListItemFields}; #[derive(Debug, Clone, Default)] pub(crate) struct FormatMdBulletListItem; impl FormatNodeRule for FormatMdBulletListItem { fn fmt_fields(&self, node: &MdBulletListItem, f: &mut MarkdownFormatter) -> FormatResult<()> { - format_verbatim_node(node.syntax()).fmt(f) + let MdBulletListItemFields { md_bullet_list } = node.as_fields(); + write!(f, [md_bullet_list.format()]) } } diff --git a/crates/biome_markdown_formatter/src/markdown/auxiliary/header.rs b/crates/biome_markdown_formatter/src/markdown/auxiliary/header.rs index 0347f50d96aa..7989bd63096e 100644 --- a/crates/biome_markdown_formatter/src/markdown/auxiliary/header.rs +++ b/crates/biome_markdown_formatter/src/markdown/auxiliary/header.rs @@ -4,6 +4,7 @@ use crate::shared::{TextPrintMode, TrimMode}; use crate::verbatim::format_verbatim_node; use biome_formatter::write; use biome_markdown_syntax::{MdHeader, MdHeaderFields}; +use biome_rowan::AstNode; #[derive(Debug, Clone, Default)] pub(crate) struct FormatMdHeader; diff --git a/crates/biome_markdown_formatter/src/markdown/auxiliary/inline_emphasis.rs b/crates/biome_markdown_formatter/src/markdown/auxiliary/inline_emphasis.rs index 3a9832b1df64..89970bb1285f 100644 --- a/crates/biome_markdown_formatter/src/markdown/auxiliary/inline_emphasis.rs +++ b/crates/biome_markdown_formatter/src/markdown/auxiliary/inline_emphasis.rs @@ -1,10 +1,29 @@ use crate::prelude::*; -use biome_markdown_syntax::MdInlineEmphasis; -use biome_rowan::AstNode; +use biome_formatter::write; +use biome_markdown_syntax::{ + MdInlineEmphasis, MdInlineEmphasisFields, emphasis_ext::MdEmphasisFence, +}; #[derive(Debug, Clone, Default)] pub(crate) struct FormatMdInlineEmphasis; impl FormatNodeRule for FormatMdInlineEmphasis { fn fmt_fields(&self, node: &MdInlineEmphasis, f: &mut MarkdownFormatter) -> FormatResult<()> { - format_verbatim_node(node.syntax()).fmt(f) + let MdInlineEmphasisFields { + l_fence, + content, + r_fence, + } = node.as_fields(); + + if node.fence().ok() == Some(MdEmphasisFence::DoubleStar) { + write!(f, [l_fence.format(), content.format(), r_fence.format()]) + } else { + write!( + f, + [ + format_replaced(&l_fence?, &token(MdEmphasisFence::DoubleStar.as_str())), + content.format(), + format_replaced(&r_fence?, &token(MdEmphasisFence::DoubleStar.as_str())), + ] + ) + } } } diff --git a/crates/biome_markdown_formatter/src/markdown/auxiliary/inline_italic.rs b/crates/biome_markdown_formatter/src/markdown/auxiliary/inline_italic.rs index 22c8c4557c84..9a45d8329446 100644 --- a/crates/biome_markdown_formatter/src/markdown/auxiliary/inline_italic.rs +++ b/crates/biome_markdown_formatter/src/markdown/auxiliary/inline_italic.rs @@ -1,10 +1,72 @@ use crate::prelude::*; -use biome_markdown_syntax::MdInlineItalic; +use biome_formatter::write; +use biome_markdown_syntax::{MarkdownSyntaxKind, MdInlineItalic, MdInlineItalicFields}; use biome_rowan::AstNode; #[derive(Debug, Clone, Default)] pub(crate) struct FormatMdInlineItalic; impl FormatNodeRule for FormatMdInlineItalic { fn fmt_fields(&self, node: &MdInlineItalic, f: &mut MarkdownFormatter) -> FormatResult<()> { - format_verbatim_node(node.syntax()).fmt(f) + let MdInlineItalicFields { + l_fence, + content, + r_fence, + } = node.as_fields(); + + let l_fence = l_fence?; + let r_fence = r_fence?; + + // Nested italic anywhere in the subtree → keep entire node verbatim. + // Normalizing to `_` could create `__` (bold) adjacency: `_*foo*_` → `__foo__`. + if node + .syntax() + .descendants() + .skip(1) + .any(|d| d.kind() == MarkdownSyntaxKind::MD_INLINE_ITALIC) + { + // TODO: instead of format_verbatim_node, pass options to child formatters so + // other normalizations (bold, code, etc.) still run inside nested italic content. + // See example-383.md for a case where Prettier handles escapes inside italic. + return format_verbatim_node(node.syntax()).fmt(f); + } + + let prev_is_alphanum = l_fence + .prev_token() + .and_then(|t| t.text_trimmed().chars().last()) + .is_some_and(|c| c.is_alphanumeric()); + let next_is_alphanum = r_fence + .next_token() + .and_then(|t| t.text_trimmed().chars().next()) + .is_some_and(|c| c.is_alphanumeric()); + + // See https://spec.commonmark.org/0.31.2/#emphasis-and-strong-emphasis + // Prefer `_` but use `*` when adjacent to alphanumeric + // For example, `a_b_c` won't parse `b` as italic, but `a*b*c` will). + let target_kind = if prev_is_alphanum || next_is_alphanum { + MarkdownSyntaxKind::STAR + } else { + MarkdownSyntaxKind::UNDERSCORE + }; + + write_fence(&l_fence, target_kind, f)?; + write!(f, [content.format()])?; + write_fence(&r_fence, target_kind, f) + } +} + +/// Write a fence token, reusing it if it already matches the target kind. +fn write_fence( + fence: &biome_markdown_syntax::MarkdownSyntaxToken, + target_kind: MarkdownSyntaxKind, + f: &mut MarkdownFormatter, +) -> FormatResult<()> { + if fence.kind() == target_kind { + write!(f, [fence.format()]) + } else { + let text = if target_kind == MarkdownSyntaxKind::STAR { + "*" + } else { + "_" + }; + write!(f, [format_replaced(fence, &token(text))]) } } diff --git a/crates/biome_markdown_formatter/src/markdown/auxiliary/list_marker_prefix.rs b/crates/biome_markdown_formatter/src/markdown/auxiliary/list_marker_prefix.rs index afde94c1b81b..f5d04d2fca92 100644 --- a/crates/biome_markdown_formatter/src/markdown/auxiliary/list_marker_prefix.rs +++ b/crates/biome_markdown_formatter/src/markdown/auxiliary/list_marker_prefix.rs @@ -1,10 +1,48 @@ use crate::prelude::*; -use biome_markdown_syntax::MdListMarkerPrefix; -use biome_rowan::AstNode; +use biome_formatter::{FormatRuleWithOptions, write}; +use biome_markdown_syntax::{MdListMarkerPrefix, MdListMarkerPrefixFields}; #[derive(Debug, Clone, Default)] -pub(crate) struct FormatMdListMarkerPrefix; +pub(crate) struct FormatMdListMarkerPrefix { + /// Target marker to replace with (e.g. `"-"`). `None` keeps the original. + target_marker: Option<&'static str>, +} impl FormatNodeRule for FormatMdListMarkerPrefix { fn fmt_fields(&self, node: &MdListMarkerPrefix, f: &mut MarkdownFormatter) -> FormatResult<()> { - format_verbatim_node(node.syntax()).fmt(f) + let MdListMarkerPrefixFields { + pre_marker_indent, + marker, + post_marker_space_token, + content_indent, + } = node.as_fields(); + + let marker = marker?; + + write!(f, [pre_marker_indent.format()])?; + // Note that for `- `, the parser treats the indent as part of the marker, not the content + // This is a parser bug that causes a regression + // in crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-242.md.snap + match self.target_marker { + Some(target) => write!(f, [format_replaced(&marker, &token(target))])?, + None => write!(f, [marker.format()])?, + } + + if let Some(space) = post_marker_space_token { + write!(f, [space.format()])?; + } + write!(f, [content_indent.format()]) + } +} + +pub(crate) struct FormatMdListMarkerPrefixOptions { + /// Target marker to replace with (e.g. `Some("-")`). `None` keeps the original. + pub(crate) target_marker: Option<&'static str>, +} + +impl FormatRuleWithOptions for FormatMdListMarkerPrefix { + type Options = FormatMdListMarkerPrefixOptions; + + fn with_options(mut self, options: Self::Options) -> Self { + self.target_marker = options.target_marker; + self } } diff --git a/crates/biome_markdown_formatter/tests/quick_test.rs b/crates/biome_markdown_formatter/tests/quick_test.rs index 70dd0d1b64b2..aff502a887a5 100644 --- a/crates/biome_markdown_formatter/tests/quick_test.rs +++ b/crates/biome_markdown_formatter/tests/quick_test.rs @@ -4,8 +4,7 @@ use biome_markdown_parser::parse_markdown; #[ignore] #[test] fn quick_test() { - let source = r#"[ See `AsyncGeneratorFunction`]: ./index.html -"#; + let source = ""; let parse = parse_markdown(source); // Print CST diff --git a/crates/biome_markdown_formatter/tests/specs/markdown/blockquote.md.snap b/crates/biome_markdown_formatter/tests/specs/markdown/blockquote.md.snap index fbcb8390fc46..d8ce92ecb8d4 100644 --- a/crates/biome_markdown_formatter/tests/specs/markdown/blockquote.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/markdown/blockquote.md.snap @@ -89,7 +89,7 @@ info: markdown/blockquote.md >> second level >>> third level -> quote with **bold** and *italic* +> quote with **bold** and _italic_ > quote with `inline code` diff --git a/crates/biome_markdown_formatter/tests/specs/markdown/bullet_list.md b/crates/biome_markdown_formatter/tests/specs/markdown/bullet_list.md new file mode 100644 index 000000000000..1f4e6abce262 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/markdown/bullet_list.md @@ -0,0 +1,9 @@ ++ item with __bold__ and *italic* + +- item with __bold__ and *italic* + +* item with `code` + +* - - - + +* - - -\n __bold__ diff --git a/crates/biome_markdown_formatter/tests/specs/markdown/bullet_list.md.snap b/crates/biome_markdown_formatter/tests/specs/markdown/bullet_list.md.snap new file mode 100644 index 000000000000..b1269feacd65 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/markdown/bullet_list.md.snap @@ -0,0 +1,35 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/bullet_list.md +--- + +# Input + +```md ++ item with __bold__ and *italic* + +- item with __bold__ and *italic* + +* item with `code` + +* - - - + +* - - -\n __bold__ + +``` + + +# Formatted + +```md +- item with **bold** and _italic_ + +- item with **bold** and _italic_ + +- item with `code` + +* - - - + +- - - -\n **bold** + +``` diff --git a/crates/biome_markdown_formatter/tests/specs/markdown/inline_image.md.snap b/crates/biome_markdown_formatter/tests/specs/markdown/inline_image.md.snap index b3efdc0d1ef3..3a67f60dbb74 100644 --- a/crates/biome_markdown_formatter/tests/specs/markdown/inline_image.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/markdown/inline_image.md.snap @@ -64,7 +64,7 @@ info: markdown/inline_image.md ![This is a long alt text that describes the image in great detail for accessibility purposes](https://example.com/very/long/path/to/some/deeply/nested/image.png "And a long title too") -![alt with **bold** and *italic*](image.png) +![alt with **bold** and _italic_](image.png) ![alt with `code`](image.png) diff --git a/crates/biome_markdown_formatter/tests/specs/markdown/inline_italic.md b/crates/biome_markdown_formatter/tests/specs/markdown/inline_italic.md new file mode 100644 index 000000000000..756047b70495 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/markdown/inline_italic.md @@ -0,0 +1,3 @@ +a*b*c + +a_b_c diff --git a/crates/biome_markdown_formatter/tests/specs/markdown/inline_italic.md.snap b/crates/biome_markdown_formatter/tests/specs/markdown/inline_italic.md.snap new file mode 100644 index 000000000000..4d7b49692037 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/markdown/inline_italic.md.snap @@ -0,0 +1,23 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/inline_italic.md +--- + +# Input + +```md +a*b*c + +a_b_c + +``` + + +# Formatted + +```md +a*b*c + +a_b_c + +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/blockquote/ignore-code.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/blockquote/ignore-code.md.snap index 57e23c4795c2..da74f9554e7c 100644 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/blockquote/ignore-code.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/blockquote/ignore-code.md.snap @@ -86,7 +86,17 @@ info: markdown/blockquote/ignore-code.md > - test > ```md -@@ -36,15 +38,19 @@ +@@ -18,7 +20,8 @@ + > - This is a long long + > long long long long + > long long paragraph. +-> ``` ++> ++ ``` + + ````md + > ```md +@@ -36,15 +39,19 @@ > > long long long long > > long long paragraph. > > ``` @@ -135,7 +145,8 @@ info: markdown/blockquote/ignore-code.md > - This is a long long > long long long long > long long paragraph. -> ``` +> + ``` ````md > ```md diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/blockquote/notext-end.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/blockquote/notext-end.md.snap index 308ca881b62f..09ce8c45de43 100644 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/blockquote/notext-end.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/blockquote/notext-end.md.snap @@ -43,16 +43,15 @@ info: markdown/blockquote/notext-end.md -> > `B` +>> `A` +>> `B` -+ -+> *a* -+>> # foo -+>> `a` > `b` --> _a_ + > _a_ -> -> > # foo -> > -> > `a` > `b` ++>> # foo ++>> `a` > `b` ++ > This is a quote with an italic _across multuple lines > which should just work_. So make sure there is no > if we set @@ -68,7 +67,7 @@ info: markdown/blockquote/notext-end.md >> `A` >> `B` -> *a* +> _a_ >> # foo >> `a` > `b` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-132.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/break/simple.md.snap similarity index 56% rename from crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-132.md.snap rename to crates/biome_markdown_formatter/tests/specs/prettier/markdown/break/simple.md.snap index c9de274b619a..89c3e2a4942b 100644 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-132.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/break/simple.md.snap @@ -1,16 +1,19 @@ --- source: crates/biome_formatter_test/src/snapshot_builder.rs -info: markdown/spec/example-132.md +info: markdown/break/simple.md --- # Input ```md - +123 +456 -*foo* +123\ +456 - +- 123 + 123 ``` @@ -20,21 +23,23 @@ info: markdown/spec/example-132.md ```diff --- Prettier +++ Biome -@@ -1,5 +1,5 @@ - +@@ -5,4 +5,4 @@ + 456 --_foo_ -+*foo* - - + - 123 +- 123 ++123 ``` # Output ```md - +123 +456 -*foo* +123\ +456 - +- 123 +123 ``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/emphasis/asterisk.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/emphasis/asterisk.md.snap deleted file mode 100644 index e26f8965c2b0..000000000000 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/emphasis/asterisk.md.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: crates/biome_formatter_test/src/snapshot_builder.rs -info: markdown/emphasis/asterisk.md ---- - -# Input - -```md -*123* - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Biome -@@ -1 +1 @@ --_123_ -+*123* -``` - -# Output - -```md -*123* -``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/emphasis/complex.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/emphasis/complex.md.snap deleted file mode 100644 index af343e49f45d..000000000000 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/emphasis/complex.md.snap +++ /dev/null @@ -1,35 +0,0 @@ ---- -source: crates/biome_formatter_test/src/snapshot_builder.rs -info: markdown/emphasis/complex.md ---- - -# Input - -```md -**Do you want to request a *feature* or report a *bug*?** - -*bug*? - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Biome -@@ -1,3 +1,3 @@ --**Do you want to request a _feature_ or report a _bug_?** -+**Do you want to request a *feature* or report a *bug*?** - --_bug_? -+*bug*? -``` - -# Output - -```md -**Do you want to request a *feature* or report a *bug*?** - -*bug*? -``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/emphasis/special.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/emphasis/special.md.snap index bdb778daf3ad..b59094e6e971 100644 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/emphasis/special.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/emphasis/special.md.snap @@ -50,21 +50,7 @@ info: markdown/emphasis/special.md ```diff --- Prettier +++ Biome -@@ -4,7 +4,7 @@ - - 0*1*! - --!_1_! -+!*1*! - - 0*1*2 - -@@ -12,24 +12,24 @@ - - 0*1*! - --!_1_! -+!*1*! +@@ -16,20 +16,20 @@ 0_1_2 @@ -89,7 +75,7 @@ info: markdown/emphasis/special.md 1***2***3 -1 **_2_** 3 -+1 ***2*** 3 ++1 _**2**_ 3 ``` # Output @@ -101,7 +87,7 @@ info: markdown/emphasis/special.md 0*1*! -!*1*! +!_1_! 0*1*2 @@ -109,7 +95,7 @@ info: markdown/emphasis/special.md 0*1*! -!*1*! +!_1_! 0_1_2 @@ -129,5 +115,5 @@ info: markdown/emphasis/special.md 1***2***3 -1 ***2*** 3 +1 _**2**_ 3 ``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/front-matter/custom-parser.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/front-matter/custom-parser.md.snap deleted file mode 100644 index b7d44f70a3a7..000000000000 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/front-matter/custom-parser.md.snap +++ /dev/null @@ -1,44 +0,0 @@ ---- -source: crates/biome_formatter_test/src/snapshot_builder.rs -info: markdown/front-matter/custom-parser.md ---- - -# Input - -```md ----mycustomparser -- hello: world -- 123 ---- - -__123__ -**456** - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Biome -@@ -3,5 +3,5 @@ - - 123 - --- - --**123** -+__123__ - **456** -``` - -# Output - -```md ----mycustomparser -- hello: world -- 123 ---- - -__123__ -**456** -``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/front-matter/empty.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/front-matter/empty.md.snap deleted file mode 100644 index 0a8d788af27b..000000000000 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/front-matter/empty.md.snap +++ /dev/null @@ -1,40 +0,0 @@ ---- -source: crates/biome_formatter_test/src/snapshot_builder.rs -info: markdown/front-matter/empty.md ---- - -# Input - -```md ---- ---- - -__123__ -**456** - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Biome -@@ -1,5 +1,5 @@ - --- - --- - --**123** -+__123__ - **456** -``` - -# Output - -```md ---- ---- - -__123__ -**456** -``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/liquid/unbalanced-mismatched-braces.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/liquid/unbalanced-mismatched-braces.md.snap index 3782697c08f3..7c251e49e9ca 100644 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/liquid/unbalanced-mismatched-braces.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/liquid/unbalanced-mismatched-braces.md.snap @@ -20,17 +20,17 @@ Braces {% doesn't match so these words should not be considered as * @@ -1 +1,2 @@ -Braces {% doesn't match so these words should not be considered as _liquid node_ }} + -+Braces {% doesn't match so these words should not be considered as *liquid node* }} ++Braces {% doesn't match so these words should not be considered as _liquid node_ }} ``` # Output ```md -Braces {% doesn't match so these words should not be considered as *liquid node* }} +Braces {% doesn't match so these words should not be considered as _liquid node_ }} ``` # Lines exceeding max width of 80 characters ``` - 2: Braces {% doesn't match so these words should not be considered as *liquid node* }} + 2: Braces {% doesn't match so these words should not be considered as _liquid node_ }} ``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/liquid/unbalanced-object-close-only.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/liquid/unbalanced-object-close-only.md.snap index 6fa9b4365101..dfd8c2e620e0 100644 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/liquid/unbalanced-object-close-only.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/liquid/unbalanced-object-close-only.md.snap @@ -22,7 +22,7 @@ Following brace doesn't open so these words should not be considered as -Following brace doesn't open so these words should not be considered as _liquid node_ }} + + -+Following brace doesn't open so these words should not be considered as *liquid node* }} ++Following brace doesn't open so these words should not be considered as _liquid node_ }} ``` # Output @@ -30,10 +30,10 @@ Following brace doesn't open so these words should not be considered as ```md -Following brace doesn't open so these words should not be considered as *liquid node* }} +Following brace doesn't open so these words should not be considered as _liquid node_ }} ``` # Lines exceeding max width of 80 characters ``` - 3: Following brace doesn't open so these words should not be considered as *liquid node* }} + 3: Following brace doesn't open so these words should not be considered as _liquid node_ }} ``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/liquid/unbalanced-object-open-only.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/liquid/unbalanced-object-open-only.md.snap index 37dcd8483350..80f33bbcb499 100644 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/liquid/unbalanced-object-open-only.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/liquid/unbalanced-object-open-only.md.snap @@ -22,7 +22,7 @@ This brace {{ doesn't close so these words should not be considered as * -This brace {{ doesn't close so these words should not be considered as _liquid node_ + + -+This brace {{ doesn't close so these words should not be considered as *liquid node* ++This brace {{ doesn't close so these words should not be considered as _liquid node_ ``` # Output @@ -30,10 +30,10 @@ This brace {{ doesn't close so these words should not be considered as * ```md -This brace {{ doesn't close so these words should not be considered as *liquid node* +This brace {{ doesn't close so these words should not be considered as _liquid node_ ``` # Lines exceeding max width of 80 characters ``` - 3: This brace {{ doesn't close so these words should not be considered as *liquid node* + 3: This brace {{ doesn't close so these words should not be considered as _liquid node_ ``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/liquid/unbalanced-template-close-only.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/liquid/unbalanced-template-close-only.md.snap index 0ede3f8eddf6..62c40742dfa8 100644 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/liquid/unbalanced-template-close-only.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/liquid/unbalanced-template-close-only.md.snap @@ -22,7 +22,7 @@ Following brace doesn't open so these words should not be considered as -Following brace doesn't open so these words should not be considered as _liquid node_ %} + + -+Following brace doesn't open so these words should not be considered as *liquid node* %} ++Following brace doesn't open so these words should not be considered as _liquid node_ %} ``` # Output @@ -30,10 +30,10 @@ Following brace doesn't open so these words should not be considered as ```md -Following brace doesn't open so these words should not be considered as *liquid node* %} +Following brace doesn't open so these words should not be considered as _liquid node_ %} ``` # Lines exceeding max width of 80 characters ``` - 3: Following brace doesn't open so these words should not be considered as *liquid node* %} + 3: Following brace doesn't open so these words should not be considered as _liquid node_ %} ``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/liquid/unbalanced-template-open-only.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/liquid/unbalanced-template-open-only.md.snap index 8b27066992fc..aed03b15bdae 100644 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/liquid/unbalanced-template-open-only.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/liquid/unbalanced-template-open-only.md.snap @@ -22,7 +22,7 @@ This brace {% doesn't close so these words should not be considered as * -This brace {% doesn't close so these words should not be considered as _liquid node_ + + -+This brace {% doesn't close so these words should not be considered as *liquid node* ++This brace {% doesn't close so these words should not be considered as _liquid node_ ``` # Output @@ -30,10 +30,10 @@ This brace {% doesn't close so these words should not be considered as * ```md -This brace {% doesn't close so these words should not be considered as *liquid node* +This brace {% doesn't close so these words should not be considered as _liquid node_ ``` # Lines exceeding max width of 80 characters ``` - 3: This brace {% doesn't close so these words should not be considered as *liquid node* + 3: This brace {% doesn't close so these words should not be considered as _liquid node_ ``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/combined-lists.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/combined-lists.md.snap index dab7b668c78f..412f76d2bfd9 100644 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/combined-lists.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/combined-lists.md.snap @@ -27,42 +27,36 @@ info: markdown/list/combined-lists.md ```diff --- Prettier +++ Biome -@@ -1,11 +1,13 @@ --- hello1 -+* hello1 +@@ -2,10 +2,12 @@ --- hello2 -+* hello2 -+ -+ -+* hello3 + - hello2 --- hello3 -+* hello4 ++ + - hello3 --- hello4 + - hello4 --- hello5 -+* hello5 ++ + - hello5 -- hello6 -+* hello6 ++- hello6 \ No newline at end of file ``` # Output ```md -* hello1 +- hello1 -* hello2 +- hello2 -* hello3 +- hello3 -* hello4 +- hello4 -* hello5 +- hello5 -* hello6``` +- hello6``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/interrupt.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/interrupt.md.snap index 176d9a54c82b..c93f7734e301 100644 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/interrupt.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/interrupt.md.snap @@ -18,15 +18,14 @@ info: markdown/list/interrupt.md --- Prettier +++ Biome @@ -1,3 +1,2 @@ --- Something + - Something - -+* Something ### Some heading ``` # Output ```md -* Something +- Something ### Some heading ``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/issue-7846.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/issue-7846.md.snap index 5250db03b20d..f1ce151b4335 100644 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/issue-7846.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/issue-7846.md.snap @@ -27,11 +27,14 @@ info: markdown/list/issue-7846.md +++ Biome @@ -1,11 +1,11 @@ - a a - b b +- b b - c c -+ c c - d d - e e +- d d +- e e ++b b ++c c ++d d ++e e 1. a a a - b b b @@ -49,10 +52,10 @@ info: markdown/list/issue-7846.md ```md - a a - b b - c c - d d - e e +b b +c c +d d +e e 1. a a a b b b diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/nested-checkbox.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/nested-checkbox.md.snap index 8a62f763e477..b156dc2e4921 100644 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/nested-checkbox.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/nested-checkbox.md.snap @@ -27,47 +27,45 @@ info: markdown/list/nested-checkbox.md --- Prettier +++ Biome @@ -1,9 +1,11 @@ --- parent list item parent list item parent list item parent list item parent list item parent list item + - parent list item parent list item parent list item parent list item parent list item parent list item - - child list item child list item child list item child list item child list item child list item -+* parent list item parent list item parent list item parent list item parent list item parent list item -+ -+ * child list item child list item child list item child list item child list item child list item -+ -+ paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph - paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph -+* [x] parent task list item parent task list item parent task list item parent task list item ++ - child list item child list item child list item child list item child list item child list item ++ ++ paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph --- [x] parent task list item parent task list item parent task list item parent task list item + - [x] parent task list item parent task list item parent task list item parent task list item - - [x] child task list item child task list item child task list item child task list item -+ * [x] child task list item child task list item child task list item child task list item - paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph ++ - [x] child task list item child task list item child task list item child task list item ++ + paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph ``` # Output ```md -* parent list item parent list item parent list item parent list item parent list item parent list item +- parent list item parent list item parent list item parent list item parent list item parent list item - * child list item child list item child list item child list item child list item child list item + - child list item child list item child list item child list item child list item child list item paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph -* [x] parent task list item parent task list item parent task list item parent task list item +- [x] parent task list item parent task list item parent task list item parent task list item - * [x] child task list item child task list item child task list item child task list item + - [x] child task list item child task list item child task list item child task list item paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph ``` # Lines exceeding max width of 80 characters ``` - 1: * parent list item parent list item parent list item parent list item parent list item parent list item - 3: * child list item child list item child list item child list item child list item child list item + 1: - parent list item parent list item parent list item parent list item parent list item parent list item + 3: - child list item child list item child list item child list item child list item child list item 5: paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph - 7: * [x] parent task list item parent task list item parent task list item parent task list item - 9: * [x] child task list item child task list item child task list item child task list item + 7: - [x] parent task list item parent task list item parent task list item parent task list item + 9: - [x] child task list item child task list item child task list item child task list item 11: paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph ``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/nested-tab.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/nested-tab.md.snap index 3730af73a9d5..4a6c2eb4a3f6 100644 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/nested-tab.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/nested-tab.md.snap @@ -46,14 +46,12 @@ info: markdown/list/nested-tab.md # List with 1 tab indentation and `*` - --- Top level list item 1 --- Top level list item 2 + - Top level list item 1 + - Top level list item 2 - - Nested List item 1 - - Nested List item 2 - _ Sub-Nested List item 1 - _ Sub-Nested List item 2 -+* Top level list item 1 -+* Top level list item 2 + * Nested List item 1 + * Nested List item 2 + * Sub-Nested List item 1 @@ -72,8 +70,8 @@ info: markdown/list/nested-tab.md - Sub-Nested List item 2 # List with 1 tab indentation and `*` -* Top level list item 1 -* Top level list item 2 +- Top level list item 1 +- Top level list item 2 * Nested List item 1 * Nested List item 2 * Sub-Nested List item 1 diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/separate.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/separate.md.snap new file mode 100644 index 000000000000..e009affc13f2 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/separate.md.snap @@ -0,0 +1,47 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/list/separate.md +--- + +# Input + +```md +- 123 +- 123 +- 123 + +* 123 +* 123 +* 123 + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -2,6 +2,6 @@ + - 123 + - 123 + +-* 123 +-* 123 +-* 123 ++- 123 ++- 123 ++- 123 +``` + +# Output + +```md +- 123 +- 123 +- 123 + +- 123 +- 123 +- 123 +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/tab.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/tab.md.snap index cefe4726c1ed..fc630adac54a 100644 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/tab.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/tab.md.snap @@ -39,30 +39,26 @@ info: markdown/list/tab.md --- Prettier +++ Biome @@ -1,22 +1,23 @@ --- Text -+* Text + - Text - [title](link) + [title](link) --- Text + - Text - - foo - - foo - - bar -+* Text --- Text + - foo + - foo + - bar ++ + - Text - # foo -+* Text -+ + # foo --- Text -+* Text + - Text - ``` - foo @@ -71,8 +67,7 @@ info: markdown/list/tab.md + foo + ``` --- Text -+* Text + - Text - `foo` + `foo` @@ -81,27 +76,27 @@ info: markdown/list/tab.md # Output ```md -* Text +- Text [title](link) -* Text +- Text - foo - foo - bar -* Text +- Text # foo -* Text +- Text ``` foo ``` -* Text +- Text `foo` ``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/markdown/real-world-case.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/markdown/real-world-case.md.snap index 4fc54f694a3b..868b107bc531 100644 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/markdown/real-world-case.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/markdown/real-world-case.md.snap @@ -909,122 +909,15 @@ See [CONTRIBUTING.md](CONTRIBUTING.md). ```diff --- Prettier +++ Biome -@@ -6,14 +6,13 @@ +@@ -6,7 +6,6 @@ [![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](#badge) Prettier is an opinionated code formatter with support for: - --- JavaScript, including [ES2017](https://github.com/tc39/proposals/blob/master/finished-proposals.md) --- [JSX](https://facebook.github.io/jsx/) --- [Flow](https://flow.org/) --- [TypeScript](https://www.typescriptlang.org/) --- CSS, [Less](http://lesscss.org/), and [SCSS](http://sass-lang.com) --- [JSON](http://json.org/) --- [GraphQL](http://graphql.org/) -+* JavaScript, including [ES2017](https://github.com/tc39/proposals/blob/master/finished-proposals.md) -+* [JSX](https://facebook.github.io/jsx/) -+* [Flow](https://flow.org/) -+* [TypeScript](https://www.typescriptlang.org/) -+* CSS, [Less](http://lesscss.org/), and [SCSS](http://sass-lang.com) -+* [JSON](http://json.org/) -+* [GraphQL](http://graphql.org/) - - It removes all original styling[\*](#styling-footnote) and ensures that all outputted code - conforms to a consistent style. (See this [blog post](http://jlongster.com/A-Prettier-Formatter)) -@@ -25,56 +24,56 @@ - - - --- [What does Prettier do?](#what-does-prettier-do) --- [Why Prettier?](#why-prettier) -- - [Building and enforcing a style guide](#building-and-enforcing-a-style-guide) -- - [Helping Newcomers](#helping-newcomers) -- - [Writing code](#writing-code) -- - [Easy to adopt](#easy-to-adopt) -- - [Clean up an existing codebase](#clean-up-an-existing-codebase) -- - [Ride the hype train](#ride-the-hype-train) --- [How does it compare to ESLint (or TSLint, stylelint...)?](#how-does-it-compare-to-eslint-or-tslint-stylelint) --- [Usage](#usage) -- - [CLI](#cli) -- - [ESLint](#eslint) -- - [Pre-commit Hook](#pre-commit-hook) -- - [API](#api) -- - [Excluding code from formatting](#excluding-code-from-formatting) --- [Options](#options) -- - [Print Width](#print-width) -- - [Tab Width](#tab-width) -- - [Tabs](#tabs) -- - [Semicolons](#semicolons) -- - [Quotes](#quotes) -- - [Trailing Commas](#trailing-commas) -- - [Bracket Spacing](#bracket-spacing) -- - [JSX Brackets](#jsx-brackets) -- - [Range](#range) -- - [Parser](#parser) -- - [Filepath](#filepath) --- [Configuration File](#configuration-file) -- - [Basic Configuration](#basic-configuration) -- - [Configuration Overrides](#configuration-overrides) -- - [Configuration Schema](#configuration-schema) --- [Editor Integration](#editor-integration) -- - [Atom](#atom) -- - [Emacs](#emacs) -- - [Vim](#vim) -- - [Visual Studio Code](#visual-studio-code) -- - [Visual Studio](#visual-studio) -- - [Sublime Text](#sublime-text) -- - [JetBrains WebStorm, PHPStorm, PyCharm...](#jetbrains-webstorm-phpstorm-pycharm) --- [Language Support](#language-support) --- [Related Projects](#related-projects) --- [Technical Details](#technical-details) --- [Badge](#badge) --- [Contributing](#contributing) -+* [What does Prettier do?](#what-does-prettier-do) -+* [Why Prettier?](#why-prettier) -+ + [Building and enforcing a style guide](#building-and-enforcing-a-style-guide) -+ + [Helping Newcomers](#helping-newcomers) -+ + [Writing code](#writing-code) -+ + [Easy to adopt](#easy-to-adopt) -+ + [Clean up an existing codebase](#clean-up-an-existing-codebase) -+ + [Ride the hype train](#ride-the-hype-train) -+* [How does it compare to ESLint (or TSLint, stylelint...)?](#how-does-it-compare-to-eslint-or-tslint-stylelint) -+* [Usage](#usage) -+ + [CLI](#cli) -+ + [ESLint](#eslint) -+ + [Pre-commit Hook](#pre-commit-hook) -+ + [API](#api) -+ + [Excluding code from formatting](#excluding-code-from-formatting) -+* [Options](#options) -+ + [Print Width](#print-width) -+ + [Tab Width](#tab-width) -+ + [Tabs](#tabs) -+ + [Semicolons](#semicolons) -+ + [Quotes](#quotes) -+ + [Trailing Commas](#trailing-commas) -+ + [Bracket Spacing](#bracket-spacing) -+ + [JSX Brackets](#jsx-brackets) -+ + [Range](#range) -+ + [Parser](#parser) -+ + [Filepath](#filepath) -+* [Configuration File](#configuration-file) -+ + [Basic Configuration](#basic-configuration) -+ + [Configuration Overrides](#configuration-overrides) -+ + [Configuration Schema](#configuration-schema) -+* [Editor Integration](#editor-integration) -+ + [Atom](#atom) -+ + [Emacs](#emacs) -+ + [Vim](#vim) -+ + [Visual Studio Code](#visual-studio-code) -+ + [Visual Studio](#visual-studio) -+ + [Sublime Text](#sublime-text) -+ + [JetBrains WebStorm, PHPStorm, PyCharm...](#jetbrains-webstorm-phpstorm-pycharm) -+* [Language Support](#language-support) -+* [Related Projects](#related-projects) -+* [Technical Details](#technical-details) -+* [Badge](#badge) -+* [Contributing](#contributing) - - + - JavaScript, including [ES2017](https://github.com/tc39/proposals/blob/master/finished-proposals.md) + - [JSX](https://facebook.github.io/jsx/) + - [Flow](https://flow.org/) +@@ -74,7 +73,7 @@ @@ -1102,15 +995,6 @@ See [CONTRIBUTING.md](CONTRIBUTING.md). ## Usage Install: -@@ -216,7 +212,7 @@ - yarn global add prettier - ``` - --_We're using `yarn` but you can use `npm` if you like:_ -+*We're using `yarn` but you can use `npm` if you like:* - - ``` - npm install --save-dev --save-exact prettier @@ -281,12 +277,11 @@ #### `--ignore-path` @@ -1164,17 +1048,13 @@ See [CONTRIBUTING.md](CONTRIBUTING.md). ##### Option 2. [pre-commit](https://github.com/pre-commit/pre-commit) Copy the following config into your `.pre-commit-config.yaml` file: -@@ -471,9 +467,8 @@ +@@ -471,7 +467,6 @@ `resolveConfig` can be used to resolve configuration for a given source file. The function optionally accepts an input file path as an argument, which defaults to the current working directory. A promise is returned which will resolve to: - --- An options object, providing a [config file](#configuration-file) was found. --- `null`, if no file was found. -+* An options object, providing a [config file](#configuration-file) was found. -+* `null`, if no file was found. - - The promise will be rejected if there was an error parsing the configuration file. + - An options object, providing a [config file](#configuration-file) was found. + - `null`, if no file was found. @@ -497,7 +492,6 @@ #### Custom Parser API @@ -1239,8 +1119,8 @@ See [CONTRIBUTING.md](CONTRIBUTING.md). -- `true` - Add a semicolon at the end of every statement. -- `false` - Only add semicolons at the beginning of lines that may introduce ASI failures. -+ * `true` - Add a semicolon at the end of every statement. -+ * `false` - Only add semicolons at the beginning of lines that may introduce ASI failures. ++ - `true` - Add a semicolon at the end of every statement. ++ - `false` - Only add semicolons at the beginning of lines that may introduce ASI failures. -| Default | CLI Override | API Override | -| ------- | ------------ | -------------- | @@ -1255,10 +1135,8 @@ See [CONTRIBUTING.md](CONTRIBUTING.md). Notes: - --- Quotes in JSX will always be double and ignore this setting. --- If the number of quotes outweighs the other quote, the quote which is less used will be used to format the string - Example: `"I'm double quoted"` results in `"I'm double quoted"` and `"This \"example\" is single quoted"` results in `'This "example" is single quoted'`. -+* Quotes in JSX will always be double and ignore this setting. -+* If the number of quotes outweighs the other quote, the quote which is less used will be used to format the string - Example: `"I'm double quoted"` results in `"I'm double quoted"` and `"This \"example\" is single quoted"` results in `'This "example" is single quoted'`. + - Quotes in JSX will always be double and ignore this setting. + - If the number of quotes outweighs the other quote, the quote which is less used will be used to format the string - Example: `"I'm double quoted"` results in `"I'm double quoted"` and `"This \"example\" is single quoted"` results in `'This "example" is single quoted'`. -| Default | CLI Override | API Override | -| ------- | ---------------- | --------------------- | @@ -1273,32 +1151,32 @@ See [CONTRIBUTING.md](CONTRIBUTING.md). for example, never gets trailing commas.) Valid options: -+ * `"none"` - No trailing commas. -+ * `"es5"` - Trailing commas where valid in ES5 (objects, arrays, etc.) -+ * `"all"` - Trailing commas wherever possible (including function arguments). This requires node 8 or a [transform](https://babeljs.io/docs/plugins/syntax-trailing-function-commas/). - +- -- `"none"` - No trailing commas. -- `"es5"` - Trailing commas where valid in ES5 (objects, arrays, etc.) -- `"all"` - Trailing commas wherever possible (including function arguments). This requires node 8 or a [transform](https://babeljs.io/docs/plugins/syntax-trailing-function-commas/). -+Default | CLI Override | API Override -+--------|--------------|------------- -+`"none"` | --trailing-comma | trailingComma: "" ++ - `"none"` - No trailing commas. ++ - `"es5"` - Trailing commas where valid in ES5 (objects, arrays, etc.) ++ - `"all"` - Trailing commas wherever possible (including function arguments). This requires node 8 or a [transform](https://babeljs.io/docs/plugins/syntax-trailing-function-commas/). -| Default | CLI Override | API Override | -| -------- | ------------------------------------------------------ | ------------------------------------------------------ | -| `"none"` | --trailing-comma | trailingComma: "" | -- ++Default | CLI Override | API Override ++--------|--------------|------------- ++`"none"` | --trailing-comma | trailingComma: "" + ### Bracket Spacing - Print spaces between brackets in object literals. Valid options: -- ++ - `true` - Example: `{ foo: bar }`. ++ - `false` - Example: `{foo: bar}`. + -- `true` - Example: `{ foo: bar }`. -- `false` - Example: `{foo: bar}`. -+ * `true` - Example: `{ foo: bar }`. -+ * `false` - Example: `{foo: bar}`. - +- -| Default | CLI Override | API Override | -| ------- | ---------------------- | ------------------------ | -| `true` | `--no-bracket-spacing` | `bracketSpacing: ` | @@ -1322,21 +1200,19 @@ See [CONTRIBUTING.md](CONTRIBUTING.md). Format only a segment of a file. These two options can be used to format code starting and ending at a given character offset (inclusive and exclusive, respectively). The range will extend: -+* Backwards to the start of the first line containing the selected statement. -+* Forwards to the end of the selected statement. +- + - Backwards to the start of the first line containing the selected statement. + - Forwards to the end of the selected statement. --- Backwards to the start of the first line containing the selected statement. --- Forwards to the end of the selected statement. +-| Default | CLI Override | API Override | +-| ---------- | --------------------- | ------------------- | +-| `0` | `--range-start ` | `rangeStart: ` | +-| `Infinity` | `--range-end ` | `rangeEnd: ` | +Default | CLI Override | API Override +--------|--------------|------------- +`0` | `--range-start `| `rangeStart: ` +`Infinity` | `--range-end ` | `rangeEnd: ` --| Default | CLI Override | API Override | --| ---------- | --------------------- | ------------------- | --| `0` | `--range-start ` | `rangeStart: ` | --| `Infinity` | `--range-end ` | `rangeEnd: ` | -- ### Parser - Specify which parser to use. @@ -1344,23 +1220,23 @@ See [CONTRIBUTING.md](CONTRIBUTING.md). Both the `babylon` and `flow` parsers support the same set of JavaScript features (including Flow). Prettier automatically infers the parser from the input file path, so you shouldn't have to change this setting. Built-in parsers: -- ++ - [`babylon`](https://github.com/babel/babylon/) ++ - [`flow`](https://github.com/facebook/flow/tree/master/src/parser) ++ - [`typescript`](https://github.com/eslint/typescript-eslint-parser) _Since v1.4.0_ ++ - [`postcss`](https://github.com/postcss/postcss) _Since v1.4.0_ ++ - [`json`](https://github.com/babel/babylon/tree/f09eb3200f57ea94d51c2a5b1facf2149fb406bf#babylonparseexpressioncode-options) _Since v1.5.0_ ++ - [`graphql`](https://github.com/graphql/graphql-js/tree/master/src/language) _Since v1.5.0_ + -- [`babylon`](https://github.com/babel/babylon/) -- [`flow`](https://github.com/facebook/flow/tree/master/src/parser) -- [`typescript`](https://github.com/eslint/typescript-eslint-parser) _Since v1.4.0_ -- [`postcss`](https://github.com/postcss/postcss) _Since v1.4.0_ -- [`json`](https://github.com/babel/babylon/tree/f09eb3200f57ea94d51c2a5b1facf2149fb406bf#babylonparseexpressioncode-options) _Since v1.5.0_ -- [`graphql`](https://github.com/graphql/graphql-js/tree/master/src/language) _Since v1.5.0_ -+ * [`babylon`](https://github.com/babel/babylon/) -+ * [`flow`](https://github.com/facebook/flow/tree/master/src/parser) -+ * [`typescript`](https://github.com/eslint/typescript-eslint-parser) _Since v1.4.0_ -+ * [`postcss`](https://github.com/postcss/postcss) _Since v1.4.0_ -+ * [`json`](https://github.com/babel/babylon/tree/f09eb3200f57ea94d51c2a5b1facf2149fb406bf#babylonparseexpressioncode-options) _Since v1.5.0_ -+ * [`graphql`](https://github.com/graphql/graphql-js/tree/master/src/language) _Since v1.5.0_ - --[Custom parsers](#custom-parser-api) are also supported. _Since v1.5.0_ +[Custom parsers](#custom-parser-api) are also supported. _Since v1.5.0_ +-[Custom parsers](#custom-parser-api) are also supported. _Since v1.5.0_ +- -| Default | CLI Override | API Override | -| --------- | ----------------------------------------------- | ---------------------------------------------------------- | -| `babylon` | `--parser `
`--parser ./my-parser` | `parser: ""`
`parser: require("./my-parser")` | @@ -1389,7 +1265,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md). Prettier can restrict itself to only format files that contain a special comment, called a pragma, at the top of the file. This is very useful when gradually transitioning large, unformatted codebases to prettier. -@@ -717,18 +693,18 @@ +@@ -717,9 +693,9 @@ */ ``` @@ -1402,27 +1278,6 @@ See [CONTRIBUTING.md](CONTRIBUTING.md). ## Configuration File - Prettier uses [cosmiconfig](https://github.com/davidtheclark/cosmiconfig) for configuration file support. - This means you can configure prettier via: - --- A `.prettierrc` file, written in YAML or JSON, with optional extensions: `.yaml/.yml/.json/.js`. --- A `prettier.config.js` file that exports an object. --- A `"prettier"` key in your `package.json` file. -+* A `.prettierrc` file, written in YAML or JSON, with optional extensions: `.yaml/.yml/.json/.js`. -+* A `prettier.config.js` file that exports an object. -+* A `"prettier"` key in your `package.json` file. - - The configuration file will be resolved starting from the location of the file being formatted, - and searching up the file tree until a config file is (or isn't) found. -@@ -852,7 +828,7 @@ - `parser` API or `--parser` CLI [option](#options). - - All of JSX and Flow syntax is supported. In fact, the test suite in --`tests/flow` _is_ the entire Flow test suite and they all pass. -+`tests/flow` *is* the entire Flow test suite and they all pass. - - Prettier also supports [TypeScript](https://www.typescriptlang.org/), CSS, [Less](http://lesscss.org/), [SCSS](http://sass-lang.com), [JSON](http://json.org/), and [GraphQL](http://graphql.org/). - @@ -863,15 +839,15 @@ - [`eslint-plugin-prettier`](https://github.com/prettier/eslint-plugin-prettier) plugs Prettier into your ESLint workflow - [`eslint-config-prettier`](https://github.com/prettier/eslint-config-prettier) turns off all ESLint rules that are unnecessary or might conflict with Prettier @@ -1444,15 +1299,6 @@ See [CONTRIBUTING.md](CONTRIBUTING.md). - [`neutrino-preset-prettier`](https://github.com/SpencerCDixon/neutrino-preset-prettier) allows you to use Prettier as a Neutrino preset - [`prettier_d`](https://github.com/josephfrazier/prettier_d.js) runs Prettier as a server to avoid Node.js startup delay. It also supports configuration via `.prettierrc`, `package.json`, and `.editorconfig`. - [`Prettier Bookmarklet`](https://prettier.glitch.me/) provides a bookmarklet and exposes a REST API for Prettier that allows to format CodeMirror editor in your browser -@@ -907,7 +883,7 @@ - - ## Badge - --Show the world you're using _Prettier_ → [![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier) -+Show the world you're using *Prettier* → [![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier) - - ```md - [![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier) ``` # Output @@ -1466,13 +1312,13 @@ See [CONTRIBUTING.md](CONTRIBUTING.md). [![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](#badge) Prettier is an opinionated code formatter with support for: -* JavaScript, including [ES2017](https://github.com/tc39/proposals/blob/master/finished-proposals.md) -* [JSX](https://facebook.github.io/jsx/) -* [Flow](https://flow.org/) -* [TypeScript](https://www.typescriptlang.org/) -* CSS, [Less](http://lesscss.org/), and [SCSS](http://sass-lang.com) -* [JSON](http://json.org/) -* [GraphQL](http://graphql.org/) +- JavaScript, including [ES2017](https://github.com/tc39/proposals/blob/master/finished-proposals.md) +- [JSX](https://facebook.github.io/jsx/) +- [Flow](https://flow.org/) +- [TypeScript](https://www.typescriptlang.org/) +- CSS, [Less](http://lesscss.org/), and [SCSS](http://sass-lang.com) +- [JSON](http://json.org/) +- [GraphQL](http://graphql.org/) It removes all original styling[\*](#styling-footnote) and ensures that all outputted code conforms to a consistent style. (See this [blog post](http://jlongster.com/A-Prettier-Formatter)) @@ -1484,50 +1330,50 @@ conforms to a consistent style. (See this [blog post](http://jlongster.com/A-Pre -* [What does Prettier do?](#what-does-prettier-do) -* [Why Prettier?](#why-prettier) - + [Building and enforcing a style guide](#building-and-enforcing-a-style-guide) - + [Helping Newcomers](#helping-newcomers) - + [Writing code](#writing-code) - + [Easy to adopt](#easy-to-adopt) - + [Clean up an existing codebase](#clean-up-an-existing-codebase) - + [Ride the hype train](#ride-the-hype-train) -* [How does it compare to ESLint (or TSLint, stylelint...)?](#how-does-it-compare-to-eslint-or-tslint-stylelint) -* [Usage](#usage) - + [CLI](#cli) - + [ESLint](#eslint) - + [Pre-commit Hook](#pre-commit-hook) - + [API](#api) - + [Excluding code from formatting](#excluding-code-from-formatting) -* [Options](#options) - + [Print Width](#print-width) - + [Tab Width](#tab-width) - + [Tabs](#tabs) - + [Semicolons](#semicolons) - + [Quotes](#quotes) - + [Trailing Commas](#trailing-commas) - + [Bracket Spacing](#bracket-spacing) - + [JSX Brackets](#jsx-brackets) - + [Range](#range) - + [Parser](#parser) - + [Filepath](#filepath) -* [Configuration File](#configuration-file) - + [Basic Configuration](#basic-configuration) - + [Configuration Overrides](#configuration-overrides) - + [Configuration Schema](#configuration-schema) -* [Editor Integration](#editor-integration) - + [Atom](#atom) - + [Emacs](#emacs) - + [Vim](#vim) - + [Visual Studio Code](#visual-studio-code) - + [Visual Studio](#visual-studio) - + [Sublime Text](#sublime-text) - + [JetBrains WebStorm, PHPStorm, PyCharm...](#jetbrains-webstorm-phpstorm-pycharm) -* [Language Support](#language-support) -* [Related Projects](#related-projects) -* [Technical Details](#technical-details) -* [Badge](#badge) -* [Contributing](#contributing) +- [What does Prettier do?](#what-does-prettier-do) +- [Why Prettier?](#why-prettier) + - [Building and enforcing a style guide](#building-and-enforcing-a-style-guide) + - [Helping Newcomers](#helping-newcomers) + - [Writing code](#writing-code) + - [Easy to adopt](#easy-to-adopt) + - [Clean up an existing codebase](#clean-up-an-existing-codebase) + - [Ride the hype train](#ride-the-hype-train) +- [How does it compare to ESLint (or TSLint, stylelint...)?](#how-does-it-compare-to-eslint-or-tslint-stylelint) +- [Usage](#usage) + - [CLI](#cli) + - [ESLint](#eslint) + - [Pre-commit Hook](#pre-commit-hook) + - [API](#api) + - [Excluding code from formatting](#excluding-code-from-formatting) +- [Options](#options) + - [Print Width](#print-width) + - [Tab Width](#tab-width) + - [Tabs](#tabs) + - [Semicolons](#semicolons) + - [Quotes](#quotes) + - [Trailing Commas](#trailing-commas) + - [Bracket Spacing](#bracket-spacing) + - [JSX Brackets](#jsx-brackets) + - [Range](#range) + - [Parser](#parser) + - [Filepath](#filepath) +- [Configuration File](#configuration-file) + - [Basic Configuration](#basic-configuration) + - [Configuration Overrides](#configuration-overrides) + - [Configuration Schema](#configuration-schema) +- [Editor Integration](#editor-integration) + - [Atom](#atom) + - [Emacs](#emacs) + - [Vim](#vim) + - [Visual Studio Code](#visual-studio-code) + - [Visual Studio](#visual-studio) + - [Sublime Text](#sublime-text) + - [JetBrains WebStorm, PHPStorm, PyCharm...](#jetbrains-webstorm-phpstorm-pycharm) +- [Language Support](#language-support) +- [Related Projects](#related-projects) +- [Technical Details](#technical-details) +- [Badge](#badge) +- [Contributing](#contributing) @@ -1672,7 +1518,7 @@ You can install it globally if you like: yarn global add prettier ``` -*We're using `yarn` but you can use `npm` if you like:* +_We're using `yarn` but you can use `npm` if you like:_ ``` npm install --save-dev --save-exact prettier @@ -1927,8 +1773,8 @@ prettier.formatWithCursor(" 1", { cursorOffset: 2 }); `resolveConfig` can be used to resolve configuration for a given source file. The function optionally accepts an input file path as an argument, which defaults to the current working directory. A promise is returned which will resolve to: -* An options object, providing a [config file](#configuration-file) was found. -* `null`, if no file was found. +- An options object, providing a [config file](#configuration-file) was found. +- `null`, if no file was found. The promise will be rejected if there was an error parsing the configuration file. @@ -2040,8 +1886,8 @@ Print semicolons at the ends of statements. Valid options: - * `true` - Add a semicolon at the end of every statement. - * `false` - Only add semicolons at the beginning of lines that may introduce ASI failures. + - `true` - Add a semicolon at the end of every statement. + - `false` - Only add semicolons at the beginning of lines that may introduce ASI failures. Default | CLI Override | API Override --------|--------------|------------- @@ -2051,8 +1897,8 @@ Default | CLI Override | API Override Use single quotes instead of double quotes. Notes: -* Quotes in JSX will always be double and ignore this setting. -* If the number of quotes outweighs the other quote, the quote which is less used will be used to format the string - Example: `"I'm double quoted"` results in `"I'm double quoted"` and `"This \"example\" is single quoted"` results in `'This "example" is single quoted'`. +- Quotes in JSX will always be double and ignore this setting. +- If the number of quotes outweighs the other quote, the quote which is less used will be used to format the string - Example: `"I'm double quoted"` results in `"I'm double quoted"` and `"This \"example\" is single quoted"` results in `'This "example" is single quoted'`. Default | CLI Override | API Override --------|--------------|------------- @@ -2063,9 +1909,9 @@ Print trailing commas wherever possible when multi-line. (A single-line array, for example, never gets trailing commas.) Valid options: - * `"none"` - No trailing commas. - * `"es5"` - Trailing commas where valid in ES5 (objects, arrays, etc.) - * `"all"` - Trailing commas wherever possible (including function arguments). This requires node 8 or a [transform](https://babeljs.io/docs/plugins/syntax-trailing-function-commas/). + - `"none"` - No trailing commas. + - `"es5"` - Trailing commas where valid in ES5 (objects, arrays, etc.) + - `"all"` - Trailing commas wherever possible (including function arguments). This requires node 8 or a [transform](https://babeljs.io/docs/plugins/syntax-trailing-function-commas/). Default | CLI Override | API Override --------|--------------|------------- @@ -2075,8 +1921,8 @@ Default | CLI Override | API Override Print spaces between brackets in object literals. Valid options: - * `true` - Example: `{ foo: bar }`. - * `false` - Example: `{foo: bar}`. + - `true` - Example: `{ foo: bar }`. + - `false` - Example: `{foo: bar}`. Default | CLI Override | API Override --------|--------------|------------- @@ -2093,8 +1939,8 @@ Default | CLI Override | API Override Format only a segment of a file. These two options can be used to format code starting and ending at a given character offset (inclusive and exclusive, respectively). The range will extend: -* Backwards to the start of the first line containing the selected statement. -* Forwards to the end of the selected statement. +- Backwards to the start of the first line containing the selected statement. +- Forwards to the end of the selected statement. Default | CLI Override | API Override --------|--------------|------------- @@ -2107,12 +1953,12 @@ Specify which parser to use. Both the `babylon` and `flow` parsers support the same set of JavaScript features (including Flow). Prettier automatically infers the parser from the input file path, so you shouldn't have to change this setting. Built-in parsers: - * [`babylon`](https://github.com/babel/babylon/) - * [`flow`](https://github.com/facebook/flow/tree/master/src/parser) - * [`typescript`](https://github.com/eslint/typescript-eslint-parser) _Since v1.4.0_ - * [`postcss`](https://github.com/postcss/postcss) _Since v1.4.0_ - * [`json`](https://github.com/babel/babylon/tree/f09eb3200f57ea94d51c2a5b1facf2149fb406bf#babylonparseexpressioncode-options) _Since v1.5.0_ - * [`graphql`](https://github.com/graphql/graphql-js/tree/master/src/language) _Since v1.5.0_ + - [`babylon`](https://github.com/babel/babylon/) + - [`flow`](https://github.com/facebook/flow/tree/master/src/parser) + - [`typescript`](https://github.com/eslint/typescript-eslint-parser) _Since v1.4.0_ + - [`postcss`](https://github.com/postcss/postcss) _Since v1.4.0_ + - [`json`](https://github.com/babel/babylon/tree/f09eb3200f57ea94d51c2a5b1facf2149fb406bf#babylonparseexpressioncode-options) _Since v1.5.0_ + - [`graphql`](https://github.com/graphql/graphql-js/tree/master/src/language) _Since v1.5.0_ [Custom parsers](#custom-parser-api) are also supported. _Since v1.5.0_ @@ -2162,9 +2008,9 @@ Default | CLI Override | API Override Prettier uses [cosmiconfig](https://github.com/davidtheclark/cosmiconfig) for configuration file support. This means you can configure prettier via: -* A `.prettierrc` file, written in YAML or JSON, with optional extensions: `.yaml/.yml/.json/.js`. -* A `prettier.config.js` file that exports an object. -* A `"prettier"` key in your `package.json` file. +- A `.prettierrc` file, written in YAML or JSON, with optional extensions: `.yaml/.yml/.json/.js`. +- A `prettier.config.js` file that exports an object. +- A `"prettier"` key in your `package.json` file. The configuration file will be resolved starting from the location of the file being formatted, and searching up the file tree until a config file is (or isn't) found. @@ -2288,7 +2134,7 @@ features enabled, but you can also use the `parser` API or `--parser` CLI [option](#options). All of JSX and Flow syntax is supported. In fact, the test suite in -`tests/flow` *is* the entire Flow test suite and they all pass. +`tests/flow` _is_ the entire Flow test suite and they all pass. Prettier also supports [TypeScript](https://www.typescriptlang.org/), CSS, [Less](http://lesscss.org/), [SCSS](http://sass-lang.com), [JSON](http://json.org/), and [GraphQL](http://graphql.org/). @@ -2343,7 +2189,7 @@ More (rough) details can be found in [commands.md](commands.md). ## Badge -Show the world you're using *Prettier* → [![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier) +Show the world you're using _Prettier_ → [![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier) ```md [![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier) @@ -2360,12 +2206,12 @@ See [CONTRIBUTING.md](CONTRIBUTING.md). 4: [![Codecov](https://img.shields.io/codecov/c/github/prettier/prettier.svg)](https://codecov.io/gh/prettier/prettier) 5: [![NPM version](https://img.shields.io/npm/v/prettier.svg)](https://www.npmjs.com/package/prettier) 6: [![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](#badge) - 9: * JavaScript, including [ES2017](https://github.com/tc39/proposals/blob/master/finished-proposals.md) + 9: - JavaScript, including [ES2017](https://github.com/tc39/proposals/blob/master/finished-proposals.md) 17: It removes all original styling[\*](#styling-footnote) and ensures that all outputted code 18: conforms to a consistent style. (See this [blog post](http://jlongster.com/A-Prettier-Formatter)) - 29: + [Building and enforcing a style guide](#building-and-enforcing-a-style-guide) - 35: * [How does it compare to ESLint (or TSLint, stylelint...)?](#how-does-it-compare-to-eslint-or-tslint-stylelint) - 65: + [JetBrains WebStorm, PHPStorm, PyCharm...](#jetbrains-webstorm-phpstorm-pycharm) + 29: - [Building and enforcing a style guide](#building-and-enforcing-a-style-guide) + 35: - [How does it compare to ESLint (or TSLint, stylelint...)?](#how-does-it-compare-to-eslint-or-tslint-stylelint) + 65: - [JetBrains WebStorm, PHPStorm, PyCharm...](#jetbrains-webstorm-phpstorm-pycharm) 80: Prettier takes your code and reprints it from scratch by taking the line length into account. 88: It fits in a single line so it's going to stay as is. However, we've all run into this situation: 92: foo(reallyLongArg(), omgSoManyParameters(), IShouldRefactorThis(), isThereSeriouslyAnotherOne()); @@ -2444,21 +2290,21 @@ See [CONTRIBUTING.md](CONTRIBUTING.md). 549: Prettier ships with a handful of customizable format options, usable in both the CLI and API. 556: >In code styleguides, maximum line length rules are often set to 100 or 120. However, when humans write code, they don't strive to reach the maximum number of columns on every line. Developers often use whitespace to break up long lines for readability. In practice, the average line length often ends up well below the maximum. 558: > Prettier, on the other hand, strives to fit the most code into every line. With the print width set to 120, prettier may produce overly compact, or otherwise undesirable code. - 584: * `false` - Only add semicolons at the beginning of lines that may introduce ASI failures. - 595: * If the number of quotes outweighs the other quote, the quote which is less used will be used to format the string - Example: `"I'm double quoted"` results in `"I'm double quoted"` and `"This \"example\" is single quoted"` results in `'This "example" is single quoted'`. - 608: * `"all"` - Trailing commas wherever possible (including function arguments). This requires node 8 or a [transform](https://babeljs.io/docs/plugins/syntax-trailing-function-commas/). + 584: - `false` - Only add semicolons at the beginning of lines that may introduce ASI failures. + 595: - If the number of quotes outweighs the other quote, the quote which is less used will be used to format the string - Example: `"I'm double quoted"` results in `"I'm double quoted"` and `"This \"example\" is single quoted"` results in `'This "example" is single quoted'`. + 608: - `"all"` - Trailing commas wherever possible (including function arguments). This requires node 8 or a [transform](https://babeljs.io/docs/plugins/syntax-trailing-function-commas/). 612: `"none"` | --trailing-comma | trailingComma: "" 626: Put the `>` of a multi-line JSX element at the end of the last line instead of being alone on the next line (does not apply to self closing elements). 635: These two options can be used to format code starting and ending at a given character offset (inclusive and exclusive, respectively). The range will extend: 647: Both the `babylon` and `flow` parsers support the same set of JavaScript features (including Flow). Prettier automatically infers the parser from the input file path, so you shouldn't have to change this setting. - 652: * [`typescript`](https://github.com/eslint/typescript-eslint-parser) _Since v1.4.0_ - 654: * [`json`](https://github.com/babel/babylon/tree/f09eb3200f57ea94d51c2a5b1facf2149fb406bf#babylonparseexpressioncode-options) _Since v1.5.0_ - 655: * [`graphql`](https://github.com/graphql/graphql-js/tree/master/src/language) _Since v1.5.0_ + 652: - [`typescript`](https://github.com/eslint/typescript-eslint-parser) _Since v1.4.0_ + 654: - [`json`](https://github.com/babel/babylon/tree/f09eb3200f57ea94d51c2a5b1facf2149fb406bf#babylonparseexpressioncode-options) _Since v1.5.0_ + 655: - [`graphql`](https://github.com/graphql/graphql-js/tree/master/src/language) _Since v1.5.0_ 661: `babylon` | `--parser `
`--parser ./my-parser` | `parser: ""`
`parser: require("./my-parser")` 677: Prettier can restrict itself to only format files that contain a special comment, called a pragma, at the top of the file. This is very useful 680: For example, a file with the following as its first comment will be formatted when `--require-pragma` is supplied: 702: Prettier uses [cosmiconfig](https://github.com/davidtheclark/cosmiconfig) for configuration file support. - 705: * A `.prettierrc` file, written in YAML or JSON, with optional extensions: `.yaml/.yml/.json/.js`. + 705: - A `.prettierrc` file, written in YAML or JSON, with optional extensions: `.yaml/.yml/.json/.js`. 709: The configuration file will be resolved starting from the location of the file being formatted, 736: Prettier borrows eslint's [override format](http://eslint.org/docs/user-guide/configuring#example-configuration). 764: `excludeFiles` may be optionally provided to exclude files for a given rule, and may also be a string or array of strings. @@ -2484,6 +2330,6 @@ See [CONTRIBUTING.md](CONTRIBUTING.md). 856: - [`markdown-magic-prettier`](https://github.com/camacho/markdown-magic-prettier) allows you to use Prettier to format JS [codeblocks](https://help.github.com/articles/creating-and-highlighting-code-blocks/) in Markdown files via [Markdown Magic](https://github.com/DavidWells/markdown-magic) 857: - [`tslint-plugin-prettier`](https://github.com/ikatyang/tslint-plugin-prettier) runs Prettier as a TSLint rule and reports differences as individual TSLint issues 858: - [`tslint-config-prettier`](https://github.com/alexjoverm/tslint-config-prettier) use TSLint with Prettier without any conflict - 886: Show the world you're using *Prettier* → [![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier) + 886: Show the world you're using _Prettier_ → [![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier) 889: [![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier) ``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/markdown/test-case.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/markdown/test-case.md.snap index 75f39b779297..5be10920f44a 100644 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/markdown/test-case.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/markdown/test-case.md.snap @@ -240,10 +240,10 @@ This paragraph has some `code` in it. Header 2 -------- --# Header 1 - + -+# Header 1 ++ + # Header 1 +- ## Header 2 - ### Header 3 @@ -291,7 +291,7 @@ This paragraph has some `code` in it. > 1. This is the first list item. > 2. This is the second list item. > -@@ -73,17 +74,23 @@ +@@ -73,18 +74,24 @@ > > Markdown.generate(); @@ -302,22 +302,23 @@ This paragraph has some `code` in it. - Green - Blue +-* Red +-* Green +-* Blue + + - Red + - Green + - Blue + + -++ Red -++ Green -++ Blue ++- Red ++- Green ++- Blue + + - * Red - * Green - * Blue - --- Red --- Green --- Blue - ```markdown - Red + - Green @@ -99,6 +106,8 @@ * Blue ``` @@ -346,15 +347,15 @@ This paragraph has some `code` in it. ---- +* * * - ----- ++ +*** ++ ++***** ---- -+***** -+ +- - - -+ + +---- +--------------------------------------- * * * @@ -368,24 +369,15 @@ This paragraph has some `code` in it. This is [an example](http://example.com "Example") link. [This link](http://example.com) has no title attr. -@@ -159,13 +174,15 @@ +@@ -159,6 +174,8 @@ [id]: http://example.com "Optional Title" --_single asterisks_ - + -+*single asterisks* + - _single underscores_ - - **double asterisks** - --**double underscores** -+__double underscores__ - - *single asterisks* + _single asterisks_ + _single underscores_ @@ -175,10 +192,14 @@ __double underscores__ @@ -490,14 +482,14 @@ Header 2 - Blue -+ Red -+ Green -+ Blue +- Red +- Green +- Blue -* Red -* Green -* Blue +- Red +- Green +- Blue ```markdown @@ -584,13 +576,13 @@ This is [an example][id] reference-style link. -*single asterisks* +_single asterisks_ _single underscores_ **double asterisks** -__double underscores__ +**double underscores** *single asterisks* diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/paragraph/special-prefix.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/paragraph/special-prefix.md.snap index 70cb658e88e7..71c826875efa 100644 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/paragraph/special-prefix.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/paragraph/special-prefix.md.snap @@ -42,24 +42,6 @@ She grew up in an isolated village in the 19th century and met her father aged 2 ## Supported Rules -@@ -9,13 +9,13 @@ - - ## Supported Rules - --- [no-disabled-tests](/packages/eslint-plugin-jest/docs/rules/no-disabled-tests.md) -+* [no-disabled-tests](/packages/eslint-plugin-jest/docs/rules/no-disabled-tests.md) - - disallow disabled tests. --- [no-focused-tests](/packages/eslint-plugin-jest/docs/rules/no-focused-tests.md) -+* [no-focused-tests](/packages/eslint-plugin-jest/docs/rules/no-focused-tests.md) - - disallow focused tests. --- [no-identical-title](/packages/eslint-plugin-jest/docs/rules/no-identical-title.md) -+* [no-identical-title](/packages/eslint-plugin-jest/docs/rules/no-identical-title.md) - - disallow identical titles. --- [valid-expect](/packages/eslint-plugin-jest/docs/rules/valid-expect.md) - -+* [valid-expect](/packages/eslint-plugin-jest/docs/rules/valid-expect.md) - - ensure expect is called correctly. - - She grew up in an isolated village in the 19th century and met her father aged 29. Oh no, why are we in a numbered list now? ``` # Output @@ -76,13 +58,13 @@ abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc ## Supported Rules -* [no-disabled-tests](/packages/eslint-plugin-jest/docs/rules/no-disabled-tests.md) +- [no-disabled-tests](/packages/eslint-plugin-jest/docs/rules/no-disabled-tests.md) - disallow disabled tests. -* [no-focused-tests](/packages/eslint-plugin-jest/docs/rules/no-focused-tests.md) +- [no-focused-tests](/packages/eslint-plugin-jest/docs/rules/no-focused-tests.md) - disallow focused tests. -* [no-identical-title](/packages/eslint-plugin-jest/docs/rules/no-identical-title.md) +- [no-identical-title](/packages/eslint-plugin-jest/docs/rules/no-identical-title.md) - disallow identical titles. -* [valid-expect](/packages/eslint-plugin-jest/docs/rules/valid-expect.md) - +- [valid-expect](/packages/eslint-plugin-jest/docs/rules/valid-expect.md) - ensure expect is called correctly. She grew up in an isolated village in the 19th century and met her father aged 29. Oh no, why are we in a numbered list now? @@ -95,8 +77,8 @@ She grew up in an isolated village in the 19th century and met her father aged 2 6: - [no-focused-tests](/packages/eslint-plugin-jest/docs/rules/no-focused-tests.md) - disallow focused tests. 7: - [no-identical-title](/packages/eslint-plugin-jest/docs/rules/no-identical-title.md) - disallow identical titles. 8: - [valid-expect](/packages/eslint-plugin-jest/docs/rules/valid-expect.md) - ensure expect is called correctly. - 12: * [no-disabled-tests](/packages/eslint-plugin-jest/docs/rules/no-disabled-tests.md) - 14: * [no-focused-tests](/packages/eslint-plugin-jest/docs/rules/no-focused-tests.md) - 16: * [no-identical-title](/packages/eslint-plugin-jest/docs/rules/no-identical-title.md) + 12: - [no-disabled-tests](/packages/eslint-plugin-jest/docs/rules/no-disabled-tests.md) + 14: - [no-focused-tests](/packages/eslint-plugin-jest/docs/rules/no-focused-tests.md) + 16: - [no-identical-title](/packages/eslint-plugin-jest/docs/rules/no-identical-title.md) 21: She grew up in an isolated village in the 19th century and met her father aged 29. Oh no, why are we in a numbered list now? ``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-117.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-117.md.snap deleted file mode 100644 index ffd68542e966..000000000000 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-117.md.snap +++ /dev/null @@ -1,40 +0,0 @@ ---- -source: crates/biome_formatter_test/src/snapshot_builder.rs -info: markdown/spec/example-117.md ---- - -# Input - -```md -
- -*Markdown* - -
- -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Biome -@@ -1,5 +1,5 @@ -
- --_Markdown_ -+*Markdown* - -
-``` - -# Output - -```md -
- -*Markdown* - -
-``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-120.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-120.md.snap deleted file mode 100644 index 6eb3548974dc..000000000000 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-120.md.snap +++ /dev/null @@ -1,37 +0,0 @@ ---- -source: crates/biome_formatter_test/src/snapshot_builder.rs -info: markdown/spec/example-120.md ---- - -# Input - -```md -
-*foo* - -*bar* - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Biome -@@ -1,4 +1,4 @@ -
- *foo* - --_bar_ -+*bar* -``` - -# Output - -```md -
-*foo* - -*bar* -``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-133.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-133.md.snap deleted file mode 100644 index 8c36413726c4..000000000000 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-133.md.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: crates/biome_formatter_test/src/snapshot_builder.rs -info: markdown/spec/example-133.md ---- - -# Input - -```md -*foo* - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Biome -@@ -1 +1 @@ --_foo_ -+*foo* -``` - -# Output - -```md -*foo* -``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-140.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-140.md.snap index f80489401671..4d79fa177cd1 100644 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-140.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-140.md.snap @@ -20,13 +20,12 @@ info: markdown/spec/example-140.md @@ -1,3 +1,2 @@ - --_foo_ -+*foo* + _foo_ ``` # Output ```md -*foo* +_foo_ ``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-141.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-141.md.snap index ac8440540258..a42fb99d6742 100644 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-141.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-141.md.snap @@ -20,13 +20,12 @@ info: markdown/spec/example-141.md @@ -1,3 +1,2 @@ *bar* - --_baz_ -+*baz* + _baz_ ``` # Output ```md *bar* -*baz* +_baz_ ``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-152.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-152.md.snap deleted file mode 100644 index e9d4b2f099de..000000000000 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-152.md.snap +++ /dev/null @@ -1,40 +0,0 @@ ---- -source: crates/biome_formatter_test/src/snapshot_builder.rs -info: markdown/spec/example-152.md ---- - -# Input - -```md -
- -*Emphasized* text. - -
- -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Biome -@@ -1,5 +1,5 @@ -
- --_Emphasized_ text. -+*Emphasized* text. - -
-``` - -# Output - -```md -
- -*Emphasized* text. - -
-``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-222.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-222.md.snap index f416d5d1362d..53e3e89cab4f 100644 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-222.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-222.md.snap @@ -47,16 +47,14 @@ info: markdown/spec/example-222.md bar - ``` -@@ -14,7 +15,8 @@ +@@ -14,6 +15,7 @@ ``` - baz -- - ``` + -+ + ``` + - ``` foo - ``` # Output @@ -80,7 +78,7 @@ info: markdown/spec/example-222.md - baz - + ``` + - ``` foo diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-244.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-244.md.snap deleted file mode 100644 index 914c8c2f9b89..000000000000 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-244.md.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: crates/biome_formatter_test/src/snapshot_builder.rs -info: markdown/spec/example-244.md ---- - -# Input - -```md -* - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Biome -@@ -1 +1 @@ --- -+* -``` - -# Output - -```md -* -``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-260.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-260.md.snap index a640005f98d9..a01c55dbdc66 100644 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-260.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-260.md.snap @@ -23,7 +23,7 @@ info: markdown/spec/example-260.md - bar - -* baz -++ baz ++- baz ``` # Output @@ -31,5 +31,5 @@ info: markdown/spec/example-260.md ```md - foo - bar -+ baz +- baz ``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-269.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-269.md.snap index 71ed06d56096..5ad17729624b 100644 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-269.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-269.md.snap @@ -29,14 +29,13 @@ info: markdown/spec/example-269.md -- b -- c -- d --- e --- f --- g --- h + - b + - c + - d -+ - e + - e +-- f +-- g +-- h + - f + - g + - h @@ -50,7 +49,7 @@ info: markdown/spec/example-269.md - b - c - d - - e +- e - f - g - h diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-272.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-272.md.snap deleted file mode 100644 index 7be5f3b87450..000000000000 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-272.md.snap +++ /dev/null @@ -1,39 +0,0 @@ ---- -source: crates/biome_formatter_test/src/snapshot_builder.rs -info: markdown/spec/example-272.md ---- - -# Input - -```md -* a -* - -* c - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Biome -@@ -1,4 +1,4 @@ --- a --- -+* a -+* - --- c -+* c -``` - -# Output - -```md -* a -* - -* c -``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-277.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-277.md.snap index 894deac45e1a..86dc28da91d4 100644 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-277.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-277.md.snap @@ -20,19 +20,17 @@ info: markdown/spec/example-277.md --- Prettier +++ Biome @@ -1,3 +1,4 @@ --- a -+* a + - a > b --- c + > -+* c + - c ``` # Output ```md -* a +- a > b > -* c +- c ``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-28.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-28.md.snap index 58e3358389c9..29399fcd3b31 100644 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-28.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-28.md.snap @@ -19,20 +19,18 @@ info: markdown/spec/example-28.md --- Prettier +++ Biome @@ -1,5 +1,3 @@ --- Foo + - Foo - ---- - --- Bar -+* Foo +* * * -+* Bar + - Bar ``` # Output ```md -* Foo +- Foo * * * -* Bar +- Bar ``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-282.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-282.md.snap deleted file mode 100644 index 808e1e2656e3..000000000000 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-282.md.snap +++ /dev/null @@ -1,38 +0,0 @@ ---- -source: crates/biome_formatter_test/src/snapshot_builder.rs -info: markdown/spec/example-282.md ---- - -# Input - -```md -* foo - * bar - - baz - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Biome -@@ -1,4 +1,4 @@ --- foo -- - bar -+* foo -+ * bar - - baz -``` - -# Output - -```md -* foo - * bar - - baz -``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-288.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-288.md.snap deleted file mode 100644 index 36ce9d680f8a..000000000000 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-288.md.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: crates/biome_formatter_test/src/snapshot_builder.rs -info: markdown/spec/example-288.md ---- - -# Input - -```md -\\*emphasis* - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Biome -@@ -1 +1 @@ --\\_emphasis_ -+\\*emphasis* -``` - -# Output - -```md -\\*emphasis* -``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-325.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-325.md.snap deleted file mode 100644 index 19125c1c1ae1..000000000000 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-325.md.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: crates/biome_formatter_test/src/snapshot_builder.rs -info: markdown/spec/example-325.md ---- - -# Input - -```md -*foo bar* - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Biome -@@ -1 +1 @@ --_foo bar_ -+*foo bar* -``` - -# Output - -```md -*foo bar* -``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-35.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-35.md.snap deleted file mode 100644 index 6e39b5441d34..000000000000 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-35.md.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: crates/biome_formatter_test/src/snapshot_builder.rs -info: markdown/spec/example-35.md ---- - -# Input - -```md -# foo *bar* \*baz\* - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Biome -@@ -1 +1 @@ --# foo _bar_ \*baz\* -+# foo *bar* \*baz\* -``` - -# Output - -```md -# foo *bar* \*baz\* -``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-356.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-356.md.snap deleted file mode 100644 index 6bc404024e35..000000000000 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-356.md.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: crates/biome_formatter_test/src/snapshot_builder.rs -info: markdown/spec/example-356.md ---- - -# Input - -```md -__foo bar__ - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Biome -@@ -1 +1 @@ --**foo bar** -+__foo bar__ -``` - -# Output - -```md -__foo bar__ -``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-36.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-36.md.snap deleted file mode 100644 index 96fb82996e84..000000000000 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-36.md.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: crates/biome_formatter_test/src/snapshot_builder.rs -info: markdown/spec/example-36.md ---- - -# Input - -```md -# foo - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Biome -@@ -1 +1 @@ --# foo -+# foo -\ No newline at end of file -``` - -# Output - -```md -# foo``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-363.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-363.md.snap deleted file mode 100644 index 5ee6a19e5489..000000000000 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-363.md.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: crates/biome_formatter_test/src/snapshot_builder.rs -info: markdown/spec/example-363.md ---- - -# Input - -```md -__foo, __bar__, baz__ - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Biome -@@ -1 +1 @@ --**foo, **bar**, baz** -+__foo, __bar__, baz__ -``` - -# Output - -```md -__foo, __bar__, baz__ -``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-364.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-364.md.snap deleted file mode 100644 index 6719b2152f71..000000000000 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-364.md.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: crates/biome_formatter_test/src/snapshot_builder.rs -info: markdown/spec/example-364.md ---- - -# Input - -```md -foo-__(bar)__ - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Biome -@@ -1 +1 @@ --foo-**(bar)** -+foo-__(bar)__ -``` - -# Output - -```md -foo-__(bar)__ -``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-367.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-367.md.snap deleted file mode 100644 index 653ee560d92c..000000000000 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-367.md.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: crates/biome_formatter_test/src/snapshot_builder.rs -info: markdown/spec/example-367.md ---- - -# Input - -```md -*(**foo**)* - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Biome -@@ -1 +1 @@ --_(**foo**)_ -+*(**foo**)* -``` - -# Output - -```md -*(**foo**)* -``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-368.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-368.md.snap deleted file mode 100644 index 6c64147cb798..000000000000 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-368.md.snap +++ /dev/null @@ -1,32 +0,0 @@ ---- -source: crates/biome_formatter_test/src/snapshot_builder.rs -info: markdown/spec/example-368.md ---- - -# Input - -```md -**Gomphocarpus (*Gomphocarpus physocarpus*, syn. -*Asclepias physocarpa*)** - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Biome -@@ -1,2 +1,2 @@ --**Gomphocarpus (_Gomphocarpus physocarpus_, syn. --_Asclepias physocarpa_)** -+**Gomphocarpus (*Gomphocarpus physocarpus*, syn. -+*Asclepias physocarpa*)** -``` - -# Output - -```md -**Gomphocarpus (*Gomphocarpus physocarpus*, syn. -*Asclepias physocarpa*)** -``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-369.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-369.md.snap deleted file mode 100644 index 1d2ffd4f3759..000000000000 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-369.md.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: crates/biome_formatter_test/src/snapshot_builder.rs -info: markdown/spec/example-369.md ---- - -# Input - -```md -**foo "*bar*" foo** - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Biome -@@ -1 +1 @@ --**foo "_bar_" foo** -+**foo "*bar*" foo** -``` - -# Output - -```md -**foo "*bar*" foo** -``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-373.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-373.md.snap deleted file mode 100644 index 03a44b124e3f..000000000000 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-373.md.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: crates/biome_formatter_test/src/snapshot_builder.rs -info: markdown/spec/example-373.md ---- - -# Input - -```md -_(__foo__)_ - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Biome -@@ -1 +1 @@ --_(**foo**)_ -+_(__foo__)_ -``` - -# Output - -```md -_(__foo__)_ -``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-376.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-376.md.snap index 1035531b4365..497a3eaaaaa3 100644 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-376.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-376.md.snap @@ -18,11 +18,11 @@ __foo__bar__baz__ +++ Biome @@ -1 +1 @@ -**foo**bar**baz** -+__foo__bar__baz__ ++**foo__bar__baz** ``` # Output ```md -__foo__bar__baz__ +**foo__bar__baz** ``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-377.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-377.md.snap deleted file mode 100644 index 0b62dcdd9a9b..000000000000 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-377.md.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: crates/biome_formatter_test/src/snapshot_builder.rs -info: markdown/spec/example-377.md ---- - -# Input - -```md -__(bar)__. - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Biome -@@ -1 +1 @@ --**(bar)**. -+__(bar)__. -``` - -# Output - -```md -__(bar)__. -``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-378.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-378.md.snap deleted file mode 100644 index f3f73dabc3e1..000000000000 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-378.md.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: crates/biome_formatter_test/src/snapshot_builder.rs -info: markdown/spec/example-378.md ---- - -# Input - -```md -*foo [bar](/url)* - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Biome -@@ -1 +1 @@ --_foo [bar](/url)_ -+*foo [bar](/url)* -``` - -# Output - -```md -*foo [bar](/url)* -``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-379.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-379.md.snap deleted file mode 100644 index e95f745887fd..000000000000 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-379.md.snap +++ /dev/null @@ -1,32 +0,0 @@ ---- -source: crates/biome_formatter_test/src/snapshot_builder.rs -info: markdown/spec/example-379.md ---- - -# Input - -```md -*foo -bar* - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Biome -@@ -1,2 +1,2 @@ --_foo --bar_ -+*foo -+bar* -``` - -# Output - -```md -*foo -bar* -``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-380.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-380.md.snap deleted file mode 100644 index 4d76a86022f6..000000000000 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-380.md.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: crates/biome_formatter_test/src/snapshot_builder.rs -info: markdown/spec/example-380.md ---- - -# Input - -```md -_foo __bar__ baz_ - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Biome -@@ -1 +1 @@ --_foo **bar** baz_ -+_foo __bar__ baz_ -``` - -# Output - -```md -_foo __bar__ baz_ -``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-384.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-384.md.snap deleted file mode 100644 index 4eb1f34d12fb..000000000000 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-384.md.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: crates/biome_formatter_test/src/snapshot_builder.rs -info: markdown/spec/example-384.md ---- - -# Input - -```md -*foo **bar** baz* - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Biome -@@ -1 +1 @@ --_foo **bar** baz_ -+*foo **bar** baz* -``` - -# Output - -```md -*foo **bar** baz* -``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-385.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-385.md.snap deleted file mode 100644 index 8f8ff1d0ba15..000000000000 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-385.md.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: crates/biome_formatter_test/src/snapshot_builder.rs -info: markdown/spec/example-385.md ---- - -# Input - -```md -*foo**bar**baz* - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Biome -@@ -1 +1 @@ --_foo**bar**baz_ -+*foo**bar**baz* -``` - -# Output - -```md -*foo**bar**baz* -``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-386.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-386.md.snap index 8d7b0ac0e0a1..050a62280a53 100644 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-386.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-386.md.snap @@ -18,11 +18,11 @@ info: markdown/spec/example-386.md +++ Biome @@ -1 +1 @@ -**\*foo** bar\* -+***foo** bar* ++_**foo** bar_ ``` # Output ```md -***foo** bar* +_**foo** bar_ ``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-387.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-387.md.snap index c0e9deb2a4bc..7d651559f32a 100644 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-387.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-387.md.snap @@ -18,11 +18,11 @@ info: markdown/spec/example-387.md +++ Biome @@ -1 +1 @@ -\*foo **bar\*** -+*foo **bar*** ++_foo **bar**_ ``` # Output ```md -*foo **bar*** +_foo **bar**_ ``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-388.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-388.md.snap index 576b4a35a0db..896f189e2491 100644 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-388.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-388.md.snap @@ -18,11 +18,11 @@ info: markdown/spec/example-388.md +++ Biome @@ -1 +1 @@ -\*foo**bar\*** -+*foo**bar*** ++_foo**bar**_ ``` # Output ```md -*foo**bar*** +_foo**bar**_ ``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-395.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-395.md.snap deleted file mode 100644 index de6dccfead3d..000000000000 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-395.md.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: crates/biome_formatter_test/src/snapshot_builder.rs -info: markdown/spec/example-395.md ---- - -# Input - -```md -__foo _bar_ baz__ - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Biome -@@ -1 +1 @@ --**foo _bar_ baz** -+__foo _bar_ baz__ -``` - -# Output - -```md -__foo _bar_ baz__ -``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-396.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-396.md.snap deleted file mode 100644 index da4428fd45bb..000000000000 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-396.md.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: crates/biome_formatter_test/src/snapshot_builder.rs -info: markdown/spec/example-396.md ---- - -# Input - -```md -__foo __bar__ baz__ - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Biome -@@ -1 +1 @@ --**foo **bar** baz** -+__foo __bar__ baz__ -``` - -# Output - -```md -__foo __bar__ baz__ -``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-397.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-397.md.snap index a8f7c301d47e..2f2d33a72930 100644 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-397.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-397.md.snap @@ -18,11 +18,11 @@ ____foo__ bar__ +++ Biome @@ -1 +1 @@ -\_**\_foo** bar\_\_ -+____foo__ bar__ ++****foo** bar** ``` # Output ```md -____foo__ bar__ +****foo** bar** ``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-399.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-399.md.snap deleted file mode 100644 index 09a1283a2261..000000000000 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-399.md.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: crates/biome_formatter_test/src/snapshot_builder.rs -info: markdown/spec/example-399.md ---- - -# Input - -```md -**foo *bar* baz** - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Biome -@@ -1 +1 @@ --**foo _bar_ baz** -+**foo *bar* baz** -``` - -# Output - -```md -**foo *bar* baz** -``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-401.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-401.md.snap deleted file mode 100644 index ae80a511f3e3..000000000000 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-401.md.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: crates/biome_formatter_test/src/snapshot_builder.rs -info: markdown/spec/example-401.md ---- - -# Input - -```md -***foo* bar** - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Biome -@@ -1 +1 @@ --**_foo_ bar** -+***foo* bar** -``` - -# Output - -```md -***foo* bar** -``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-402.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-402.md.snap deleted file mode 100644 index 91e5a904cce6..000000000000 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-402.md.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: crates/biome_formatter_test/src/snapshot_builder.rs -info: markdown/spec/example-402.md ---- - -# Input - -```md -**foo *bar*** - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Biome -@@ -1 +1 @@ --**foo _bar_** -+**foo *bar*** -``` - -# Output - -```md -**foo *bar*** -``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-403.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-403.md.snap index 14c38ecf8739..e5257f5ea293 100644 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-403.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-403.md.snap @@ -20,13 +20,13 @@ bim* bop** @@ -1,2 +1,2 @@ -**foo \*bar **baz** -bim\* bop** -+**foo *bar **baz** -+bim* bop** ++**foo _bar **baz** ++bim_ bop** ``` # Output ```md -**foo *bar **baz** -bim* bop** +**foo _bar **baz** +bim_ bop** ``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-404.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-404.md.snap deleted file mode 100644 index c85f7acb59b4..000000000000 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-404.md.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: crates/biome_formatter_test/src/snapshot_builder.rs -info: markdown/spec/example-404.md ---- - -# Input - -```md -**foo [*bar*](/url)** - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Biome -@@ -1 +1 @@ --**foo [_bar_](/url)** -+**foo [*bar*](/url)** -``` - -# Output - -```md -**foo [*bar*](/url)** -``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-408.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-408.md.snap index ee632552ad45..7a495cce47a9 100644 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-408.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-408.md.snap @@ -18,11 +18,11 @@ foo *\** +++ Biome @@ -1 +1 @@ -foo \*\*\* -+foo *\** ++foo _\*_ ``` # Output ```md -foo *\** +foo _\*_ ``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-413.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-413.md.snap index 26b74532720c..74a0e2d016f4 100644 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-413.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-413.md.snap @@ -18,11 +18,11 @@ info: markdown/spec/example-413.md +++ Biome @@ -1 +1 @@ -\*_foo_ -+**foo* ++*_foo_ ``` # Output ```md -**foo* +*_foo_ ``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-414.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-414.md.snap index 7a094438c0e7..6d68ddaaf264 100644 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-414.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-414.md.snap @@ -18,11 +18,11 @@ info: markdown/spec/example-414.md +++ Biome @@ -1 +1 @@ -\*foo\*\* -+*foo** ++_foo_* ``` # Output ```md -*foo** +_foo_* ``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-418.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-418.md.snap index fbe56a9b1e89..8942a367a351 100644 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-418.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-418.md.snap @@ -18,11 +18,11 @@ info: markdown/spec/example-418.md +++ Biome @@ -1 +1 @@ -\*foo\*\*\*\* -+*foo**** ++_foo_*** ``` # Output ```md -*foo**** +_foo_*** ``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-42.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-42.md.snap deleted file mode 100644 index c7460235487c..000000000000 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-42.md.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: crates/biome_formatter_test/src/snapshot_builder.rs -info: markdown/spec/example-42.md ---- - -# Input - -```md -### foo ### - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Biome -@@ -1 +1 @@ --### foo -+### foo -\ No newline at end of file -``` - -# Output - -```md -### foo``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-423.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-423.md.snap deleted file mode 100644 index ab09f3100d52..000000000000 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-423.md.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: crates/biome_formatter_test/src/snapshot_builder.rs -info: markdown/spec/example-423.md ---- - -# Input - -```md -foo __\___ - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Biome -@@ -1 +1 @@ --foo **\_** -+foo __\___ -``` - -# Output - -```md -foo __\___ -``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-424.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-424.md.snap index 2584b0d5607a..5c90000d2c8c 100644 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-424.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-424.md.snap @@ -18,11 +18,11 @@ foo __*__ +++ Biome @@ -1 +1 @@ -foo **\*** -+foo __*__ ++foo ***** ``` # Output ```md -foo __*__ +foo ***** ``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-427.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-427.md.snap index 86ceb5e32a48..6115f490d0af 100644 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-427.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-427.md.snap @@ -18,11 +18,11 @@ ___foo__ +++ Biome @@ -1 +1 @@ -**\_foo** -+___foo__ ++_**foo** ``` # Output ```md -___foo__ +_**foo** ``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-429.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-429.md.snap index cc9909da1d3f..914c7ec609ca 100644 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-429.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-429.md.snap @@ -18,11 +18,11 @@ __foo___ +++ Biome @@ -1 +1 @@ -**foo\_** -+__foo___ ++**foo**_ ``` # Output ```md -__foo___ +**foo**_ ``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-433.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-433.md.snap deleted file mode 100644 index b1c82716fb54..000000000000 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-433.md.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: crates/biome_formatter_test/src/snapshot_builder.rs -info: markdown/spec/example-433.md ---- - -# Input - -```md -__foo__ - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Biome -@@ -1 +1 @@ --**foo** -+__foo__ -``` - -# Output - -```md -__foo__ -``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-436.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-436.md.snap index 2cc51df9f0b9..b877cf6ed24b 100644 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-436.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-436.md.snap @@ -18,11 +18,11 @@ ____foo____ +++ Biome @@ -1 +1 @@ -\_**\_foo\_\_** -+____foo____ ++****foo**** ``` # Output ```md -____foo____ +****foo**** ``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-438.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-438.md.snap index cdebb17784f7..a6b4b67368f2 100644 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-438.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-438.md.snap @@ -18,11 +18,11 @@ info: markdown/spec/example-438.md +++ Biome @@ -1 +1 @@ -**_foo_** -+***foo*** ++_**foo**_ ``` # Output ```md -***foo*** +_**foo**_ ``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-439.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-439.md.snap index 9ac8f8e908f7..c4bfa80ab7d6 100644 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-439.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-439.md.snap @@ -18,11 +18,11 @@ _____foo_____ +++ Biome @@ -1 +1 @@ -**\_**foo**\_** -+_____foo_____ ++_****foo****_ ``` # Output ```md -_____foo_____ +_****foo****_ ``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-440.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-440.md.snap index e0159934ffdb..05688fca489e 100644 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-440.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-440.md.snap @@ -18,11 +18,11 @@ info: markdown/spec/example-440.md +++ Biome @@ -1 +1 @@ -_foo \_bar_ baz\_ -+*foo _bar* baz_ ++_foo _bar_ baz_ ``` # Output ```md -*foo _bar* baz_ +_foo _bar_ baz_ ``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-442.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-442.md.snap index f2a848c7df9a..00e40c2d78d0 100644 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-442.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-442.md.snap @@ -18,11 +18,11 @@ info: markdown/spec/example-442.md +++ Biome @@ -1 +1 @@ -*foo \_\_bar *baz bim\_\_ bam\* -+*foo __bar *baz bim__ bam* ++_foo **bar *baz bim** bam_ ``` # Output ```md -*foo __bar *baz bim__ bam* +_foo **bar *baz bim** bam_ ``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-444.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-444.md.snap index cdf8f92ebed9..e374d3f5f15e 100644 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-444.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-444.md.snap @@ -18,11 +18,11 @@ info: markdown/spec/example-444.md +++ Biome @@ -1 +1 @@ -*foo *bar baz\* -+*foo *bar baz* ++*foo _bar baz_ ``` # Output ```md -*foo *bar baz* +*foo _bar baz_ ``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-450.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-450.md.snap index 24cd4abcf2ef..e91c05f8c559 100644 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-450.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-450.md.snap @@ -18,11 +18,11 @@ info: markdown/spec/example-450.md +++ Biome @@ -1 +1 @@ -_a `_`\* -+*a `*`* ++_a `*`_ ``` # Output ```md -*a `*`* +_a `*`_ ``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-482.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-482.md.snap deleted file mode 100644 index 1b0a5ec39b97..000000000000 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-482.md.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: crates/biome_formatter_test/src/snapshot_builder.rs -info: markdown/spec/example-482.md ---- - -# Input - -```md -[link *foo **bar** `#`*](/uri) - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Biome -@@ -1 +1 @@ --[link _foo **bar** `#`_](/uri) -+[link *foo **bar** `#`*](/uri) -``` - -# Output - -```md -[link *foo **bar** `#`*](/uri) -``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-485.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-485.md.snap deleted file mode 100644 index cd1f786482f5..000000000000 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-485.md.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: crates/biome_formatter_test/src/snapshot_builder.rs -info: markdown/spec/example-485.md ---- - -# Input - -```md -[foo *[bar [baz](/uri)](/uri)*](/uri) - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Biome -@@ -1 +1 @@ --[foo _[bar [baz](/uri)](/uri)_](/uri) -+[foo *[bar [baz](/uri)](/uri)*](/uri) -``` - -# Output - -```md -[foo *[bar [baz](/uri)](/uri)*](/uri) -``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-489.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-489.md.snap deleted file mode 100644 index 2de8a60b4540..000000000000 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-489.md.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: crates/biome_formatter_test/src/snapshot_builder.rs -info: markdown/spec/example-489.md ---- - -# Input - -```md -*foo [bar* baz] - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Biome -@@ -1 +1 @@ --_foo [bar_ baz] -+*foo [bar* baz] -``` - -# Output - -```md -*foo [bar* baz] -``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-499.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-499.md.snap deleted file mode 100644 index 8a875fb5a9e8..000000000000 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-499.md.snap +++ /dev/null @@ -1,34 +0,0 @@ ---- -source: crates/biome_formatter_test/src/snapshot_builder.rs -info: markdown/spec/example-499.md ---- - -# Input - -```md -[foo *bar [baz][ref]*][ref] - -[ref]: /uri - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Biome -@@ -1,3 +1,3 @@ --[foo _bar [baz][ref]_][ref] -+[foo *bar [baz][ref]*][ref] - - [ref]: /uri -``` - -# Output - -```md -[foo *bar [baz][ref]*][ref] - -[ref]: /uri -``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-602.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-602.md.snap deleted file mode 100644 index 4ee1ede36e89..000000000000 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-602.md.snap +++ /dev/null @@ -1,32 +0,0 @@ ---- -source: crates/biome_formatter_test/src/snapshot_builder.rs -info: markdown/spec/example-602.md ---- - -# Input - -```md -*foo -bar* - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Biome -@@ -1,2 +1,2 @@ --_foo --bar_ -+*foo -+bar* -``` - -# Output - -```md -*foo -bar* -``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-603.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-603.md.snap deleted file mode 100644 index 44fa2c64fc60..000000000000 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-603.md.snap +++ /dev/null @@ -1,32 +0,0 @@ ---- -source: crates/biome_formatter_test/src/snapshot_builder.rs -info: markdown/spec/example-603.md ---- - -# Input - -```md -*foo\ -bar* - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Biome -@@ -1,2 +1,2 @@ --_foo\ --bar_ -+*foo\ -+bar* -``` - -# Output - -```md -*foo\ -bar* -``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-611.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-611.md.snap deleted file mode 100644 index 47a927dee69f..000000000000 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-611.md.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: crates/biome_formatter_test/src/snapshot_builder.rs -info: markdown/spec/example-611.md ---- - -# Input - -```md -### foo - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Biome -@@ -1 +1 @@ --### foo -+### foo -\ No newline at end of file -``` - -# Output - -```md -### foo``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/strong/underscore.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/strong/underscore.md.snap deleted file mode 100644 index 52cf798c6366..000000000000 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/strong/underscore.md.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: crates/biome_formatter_test/src/snapshot_builder.rs -info: markdown/strong/underscore.md ---- - -# Input - -```md -__123__ - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Biome -@@ -1 +1 @@ --**123** -+__123__ -``` - -# Output - -```md -__123__ -``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/yaml/trailing-spaces.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/yaml/trailing-spaces.md.snap index 3dd19b7544ab..8b97236086f9 100644 --- a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/yaml/trailing-spaces.md.snap +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/yaml/trailing-spaces.md.snap @@ -22,16 +22,14 @@ This paragraph should be considered part of the _markdown_ instead of *yaml*. ```diff --- Prettier +++ Biome -@@ -1,7 +1,7 @@ +@@ -1,6 +1,6 @@ --- v spaces ---- +--- --This paragraph should be considered part of the _markdown_ instead of _yaml_. -+This paragraph should be considered part of the _markdown_ instead of *yaml*. + This paragraph should be considered part of the _markdown_ instead of _yaml_. - --- ``` # Output @@ -41,7 +39,7 @@ This paragraph should be considered part of the _markdown_ instead of *yaml*. v spaces --- -This paragraph should be considered part of the _markdown_ instead of *yaml*. +This paragraph should be considered part of the _markdown_ instead of _yaml_. --- ``` diff --git a/crates/biome_markdown_syntax/src/emphasis_ext.rs b/crates/biome_markdown_syntax/src/emphasis_ext.rs new file mode 100644 index 000000000000..f40ea9486d27 --- /dev/null +++ b/crates/biome_markdown_syntax/src/emphasis_ext.rs @@ -0,0 +1,31 @@ +use biome_rowan::SyntaxResult; + +use crate::MdInlineEmphasis; +use crate::kind::MarkdownSyntaxKind; + +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub enum MdEmphasisFence { + DoubleStar, + DoubleUnderscore, +} + +impl MdEmphasisFence { + pub fn as_str(&self) -> &'static str { + match self { + Self::DoubleStar => "**", + Self::DoubleUnderscore => "__", + } + } +} + +impl MdInlineEmphasis { + /// Returns the fence style used by this MdInlineEmphasis node. + pub fn fence(&self) -> SyntaxResult { + let l_fence = self.l_fence()?; + Ok(match l_fence.kind() { + MarkdownSyntaxKind::DOUBLE_STAR => MdEmphasisFence::DoubleStar, + MarkdownSyntaxKind::DOUBLE_UNDERSCORE => MdEmphasisFence::DoubleUnderscore, + _ => unreachable!(), + }) + } +} diff --git a/crates/biome_markdown_syntax/src/lib.rs b/crates/biome_markdown_syntax/src/lib.rs index 440b3d49a202..dc67e19cf0d4 100644 --- a/crates/biome_markdown_syntax/src/lib.rs +++ b/crates/biome_markdown_syntax/src/lib.rs @@ -1,5 +1,6 @@ #![deny(clippy::use_self)] +pub mod emphasis_ext; pub mod file_source; #[macro_use] mod generated;