diff --git a/Cargo.lock b/Cargo.lock index 1254176996e6..e6825833f673 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1307,12 +1307,21 @@ dependencies = [ name = "biome_markdown_formatter" version = "0.0.1" dependencies = [ + "biome_configuration", "biome_formatter", + "biome_formatter_test", + "biome_fs", "biome_markdown_factory", "biome_markdown_parser", "biome_markdown_syntax", "biome_parser", "biome_rowan", + "biome_service", + "camino", + "countme", + "schemars", + "serde", + "tests_macros", ] [[package]] @@ -1624,6 +1633,8 @@ dependencies = [ "biome_json_formatter", "biome_json_parser", "biome_json_syntax", + "biome_markdown_factory", + "biome_markdown_formatter", "biome_markdown_parser", "biome_markdown_syntax", "biome_module_graph", diff --git a/crates/biome_configuration/src/lib.rs b/crates/biome_configuration/src/lib.rs index 209b02fc09d0..0b1349f8fe79 100644 --- a/crates/biome_configuration/src/lib.rs +++ b/crates/biome_configuration/src/lib.rs @@ -18,6 +18,7 @@ pub mod grit; pub mod html; pub mod javascript; pub mod json; +pub mod markdown; pub mod max_size; mod overrides; pub mod vcs; @@ -34,6 +35,7 @@ use crate::graphql::{GraphqlFormatterConfiguration, GraphqlLinterConfiguration}; pub use crate::grit::{GritConfiguration, grit_configuration}; use crate::javascript::{JsFormatterConfiguration, JsLinterConfiguration}; use crate::json::{JsonFormatterConfiguration, JsonLinterConfiguration}; +pub use crate::markdown::{MarkdownConfiguration, markdown_configuration}; use crate::max_size::MaxSize; use crate::vcs::{VcsConfiguration, vcs_configuration}; pub use analyzer::{ diff --git a/crates/biome_configuration/src/markdown.rs b/crates/biome_configuration/src/markdown.rs new file mode 100644 index 000000000000..4700bf5bf04c --- /dev/null +++ b/crates/biome_configuration/src/markdown.rs @@ -0,0 +1,54 @@ +use crate::bool::Bool; +use biome_deserialize_macros::{Deserializable, Merge}; +use biome_formatter::{IndentStyle, IndentWidth, LineWidth}; +use bpaf::Bpaf; +use serde::{Deserialize, Serialize}; + +/// Options applied to Markdown files +#[derive( + Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize, Bpaf, Deserializable, Merge, +)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", default, deny_unknown_fields)] +pub struct MarkdownConfiguration { + #[bpaf(external(markdown_formatter_configuration), optional)] + #[serde(skip_serializing_if = "Option::is_none")] + pub formatter: Option, +} + +pub type MarkdownFormatterEnabled = Bool; // Keep it disabled by default while experimental. +pub type MarkdownLinterEnabled = Bool; +pub type MarkdownAssistEnabled = Bool; +pub type MarkdownParseInterpolation = Bool; + +/// Options that change how the Markdown formatter behaves +#[derive( + Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize, Bpaf, Deserializable, Merge, +)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +#[serde(rename_all = "camelCase", default, deny_unknown_fields)] +pub struct MarkdownFormatterConfiguration { + /// Control the formatter for Markdown (and its super languages) files. + #[bpaf(long("markdown-formatter-enabled"), argument("true|false"), optional)] + #[serde(skip_serializing_if = "Option::is_none")] + pub enabled: Option, + + /// The indent style applied to Markdown files. + #[bpaf( + long("markdown-formatter-indent-style"), + argument("tab|space"), + optional + )] + #[serde(skip_serializing_if = "Option::is_none")] + pub indent_style: Option, + + /// The size of the indentation applied to Markdown files. Defaults to 2. + #[bpaf(long("markdown-formatter-indent-width"), argument("NUMBER"), optional)] + #[serde(skip_serializing_if = "Option::is_none")] + pub indent_width: Option, + + /// What's the max width of a line applied to Markdown files. Defaults to 80. + #[bpaf(long("markdown-formatter-line-width"), argument("NUMBER"), optional)] + #[serde(skip_serializing_if = "Option::is_none")] + pub line_width: Option, +} diff --git a/crates/biome_markdown_formatter/Cargo.toml b/crates/biome_markdown_formatter/Cargo.toml index 1e73f9e5166e..2c79e941ad01 100644 --- a/crates/biome_markdown_formatter/Cargo.toml +++ b/crates/biome_markdown_formatter/Cargo.toml @@ -14,10 +14,23 @@ biome_formatter = { workspace = true } biome_markdown_factory = { workspace = true } biome_markdown_syntax = { workspace = true } biome_rowan = { workspace = true } +schemars = { workspace = true, optional = true } +serde = { workspace = true, features = ["derive"], optional = true } [dev-dependencies] +biome_configuration = { workspace = true } +biome_formatter_test = { workspace = true } +biome_fs = { path = "../biome_fs" } biome_markdown_parser = { workspace = true } biome_parser = { workspace = true } +biome_service = { path = "../biome_service" } +camino = { workspace = true } +countme = { workspace = true, features = ["enable"] } +tests_macros = { path = "../tests_macros" } + +[features] +schema = ["dep:schemars", "serde"] +serde = ["dep:serde"] [lints] workspace = true diff --git a/crates/biome_markdown_formatter/src/context.rs b/crates/biome_markdown_formatter/src/context.rs index ef197d997424..6d0a850a5b05 100644 --- a/crates/biome_markdown_formatter/src/context.rs +++ b/crates/biome_markdown_formatter/src/context.rs @@ -1,4 +1,4 @@ -use std::rc::Rc; +use std::{fmt, rc::Rc}; use biome_formatter::{ CstFormatContext, FormatContext, FormatOptions, IndentStyle, IndentWidth, LineEnding, @@ -62,10 +62,40 @@ impl FormatOptions for MarkdownFormatOptions { } impl MarkdownFormatOptions { + pub fn new() -> Self { + Self { + indent_style: IndentStyle::default(), + indent_width: IndentWidth::default(), + line_ending: LineEnding::default(), + line_width: LineWidth::default(), + trailing_newline: TrailingNewline::default(), + } + } + + pub fn with_indent_style(mut self, indent_style: IndentStyle) -> Self { + self.indent_style = indent_style; + self + } + + pub fn with_indent_width(mut self, indent_width: IndentWidth) -> Self { + self.indent_width = indent_width; + self + } + pub fn with_line_width(mut self, line_width: LineWidth) -> Self { self.line_width = line_width; self } + + pub fn with_line_ending(mut self, line_ending: LineEnding) -> Self { + self.line_ending = line_ending; + self + } + + pub fn with_trailing_newline(mut self, trailing_newline: TrailingNewline) -> Self { + self.trailing_newline = trailing_newline; + self + } } impl MarkdownFormatContext { @@ -98,3 +128,9 @@ impl FormatContext for MarkdownFormatContext { None } } + +impl fmt::Display for MarkdownFormatOptions { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + std::fmt::Debug::fmt(self, f) + } +} diff --git a/crates/biome_markdown_formatter/tests/language.rs b/crates/biome_markdown_formatter/tests/language.rs new file mode 100644 index 000000000000..5e664bb8d9f8 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/language.rs @@ -0,0 +1,39 @@ +use biome_formatter_test::TestFormatLanguage; +use biome_fs::BiomePath; +use biome_markdown_formatter::{MarkdownFormatLanguage, context::MarkdownFormatContext}; +use biome_markdown_parser::parse_markdown; +use biome_markdown_syntax::MarkdownLanguage; +use biome_parser::AnyParse; +use biome_service::{ + settings::{ServiceLanguage, Settings}, + workspace::DocumentFileSource, +}; + +#[derive(Default)] +pub struct MarkdownTestFormatLanguage {} + +impl TestFormatLanguage for MarkdownTestFormatLanguage { + type ServiceLanguage = MarkdownLanguage; + type Context = MarkdownFormatContext; + type FormatLanguage = MarkdownFormatLanguage; + + fn parse(&self, text: &str) -> AnyParse { + parse_markdown(text).into() + } + + fn to_format_language( + &self, + settings: &Settings, + file_source: &DocumentFileSource, + ) -> Self::FormatLanguage { + let language_settings = &settings.languages.markdown.formatter; + let options = Self::ServiceLanguage::resolve_format_options( + &settings.formatter, + &settings.override_settings, + language_settings, + &BiomePath::new(""), + file_source, + ); + MarkdownFormatLanguage::new(options) + } +} diff --git a/crates/biome_markdown_formatter/tests/prettier_tests.rs b/crates/biome_markdown_formatter/tests/prettier_tests.rs new file mode 100644 index 000000000000..3ac04f2eb45f --- /dev/null +++ b/crates/biome_markdown_formatter/tests/prettier_tests.rs @@ -0,0 +1,29 @@ +use biome_formatter::{IndentStyle, IndentWidth}; +use biome_formatter_test::test_prettier_snapshot::{PrettierSnapshot, PrettierTestFile}; +use biome_markdown_formatter::{MarkdownFormatLanguage, context::MarkdownFormatOptions}; +use camino::Utf8Path; +use std::env; + +mod language { + include!("language.rs"); +} + +tests_macros::gen_tests! {"tests/specs/prettier/markdown/**/*.{md}", crate::test_snapshot, ""} + +fn test_snapshot(input: &'static str, _: &str, _: &str, _: &str) { + countme::enable(true); + + let root_path = Utf8Path::new(concat!( + env!("CARGO_MANIFEST_DIR"), + "/tests/specs/prettier/" + )); + + let test_file = PrettierTestFile::new(input, root_path); + let options = MarkdownFormatOptions::default() + .with_indent_style(IndentStyle::Space) + .with_indent_width(IndentWidth::default()); + let language = language::MarkdownTestFormatLanguage::default(); + let snapshot = PrettierSnapshot::new(test_file, language, MarkdownFormatLanguage::new(options)); + + snapshot.test() +} diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/blockquote/code.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/blockquote/code.md.snap new file mode 100644 index 000000000000..093bba36f044 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/blockquote/code.md.snap @@ -0,0 +1,98 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/blockquote/code.md +--- +# Input + +```md +> NOTE: To use `unobtrusive`, `unobtrusive/import`, `unobtrusive/react`, and `unobtrusive/flowtype` together, your eslint config would look like this: +>```json +>{ +> "extends": [ +> "unobtrusive", +> "unobtrusive/import", +> "unobtrusive/react", +> "unobtrusive/flowtype" +> ], +> "env": { +> "browser": true +> } +>} +>``` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,7 +1,6 @@ + > NOTE: To use `unobtrusive`, `unobtrusive/import`, `unobtrusive/react`, and `unobtrusive/flowtype` together, your eslint config would look like this: +-> +-> ```json +-> { ++>```json ++>{ + > "extends": [ + > "unobtrusive", + > "unobtrusive/import", +@@ -11,5 +10,5 @@ + > "env": { + > "browser": true + > } +-> } +-> ``` ++>} ++>``` +``` + +# Output + +```md +> NOTE: To use `unobtrusive`, `unobtrusive/import`, `unobtrusive/react`, and `unobtrusive/flowtype` together, your eslint config would look like this: +>```json +>{ +> "extends": [ +> "unobtrusive", +> "unobtrusive/import", +> "unobtrusive/react", +> "unobtrusive/flowtype" +> ], +> "env": { +> "browser": true +> } +>} +>``` +``` + +# Errors +``` +code.md:2:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Unterminated fenced code block, expected closing triple backticks (```). + + 1 │ > NOTE: To use `unobtrusive`, `unobtrusive/import`, `unobtrusive/react`, and `unobtrusive/flowtype` together, your eslint config would look like this: + > 2 │ >```json + │ ^^^ + 3 │ >{ + 4 │ > "extends": [ + + i code block started here + + 1 │ > NOTE: To use `unobtrusive`, `unobtrusive/import`, `unobtrusive/react`, and `unobtrusive/flowtype` together, your eslint config would look like this: + > 2 │ >```json + │ ^^^ + 3 │ >{ + 4 │ > "extends": [ + + i Add closing triple backticks (```) at the start of a new line. + + +``` + +# Lines exceeding max width of 80 characters +``` + 1: > NOTE: To use `unobtrusive`, `unobtrusive/import`, `unobtrusive/react`, and `unobtrusive/flowtype` together, your eslint config would look like this: +``` 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 new file mode 100644 index 000000000000..f594c74b5da2 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/blockquote/ignore-code.md.snap @@ -0,0 +1,253 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/blockquote/ignore-code.md +--- +# Input + +```md +> ````md +> +> ```js +> ugly ( code ) ; +> ``` +> ```` + +> ```md +> +> - This is a long long +> long long long long +> long long paragraph. +> ``` + +> - test +> ```md +> +> - This is a long long +> long long long long +> long long paragraph. +> ``` + +````md +> ```md +> +> - This is a long long +> long long long long +> long long paragraph. +> ``` +```` + +> ````md +> > ```md +> > +> > - This is a long long +> > long long long long +> > long long paragraph. +> > ``` +> ```` + +> +> +> - This is a long long +> long long long long +> long long paragraph. +> + +> ````js +> // prettier-ignore +> const x = 1, +> b = 2 +> ```` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -38,13 +38,15 @@ + > > ``` + > ```` + ++> + > + > - This is a long long + > long long long long + > long long paragraph. ++> + +-> ```js ++> ````js + > // prettier-ignore + > const x = 1, + > b = 2 +-> ``` ++> ```` +``` + +# Output + +```md +> ````md +> +> ```js +> ugly ( code ) ; +> ``` +> ```` + +> ```md +> +> - This is a long long +> long long long long +> long long paragraph. +> ``` + +> - test +> ```md +> +> - This is a long long +> long long long long +> long long paragraph. +> ``` + +````md +> ```md +> +> - This is a long long +> long long long long +> long long paragraph. +> ``` +```` + +> ````md +> > ```md +> > +> > - This is a long long +> > long long long long +> > long long paragraph. +> > ``` +> ```` + +> +> +> - This is a long long +> long long long long +> long long paragraph. +> + +> ````js +> // prettier-ignore +> const x = 1, +> b = 2 +> ```` +``` + +# Errors +``` +ignore-code.md:1:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Unterminated fenced code block, expected closing triple backticks (```). + + > 1 │ > ````md + │ ^^^^ + 2 │ > + 3 │ > ```js + + i code block started here + + > 1 │ > ````md + │ ^^^^ + 2 │ > + 3 │ > ```js + + i Add closing triple backticks (```) at the start of a new line. + +ignore-code.md:8:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Unterminated fenced code block, expected closing triple backticks (```). + + 6 │ > ```` + 7 │ + > 8 │ > ```md + │ ^^^ + 9 │ > + 10 │ > - This is a long long + + i code block started here + + 6 │ > ```` + 7 │ + > 8 │ > ```md + │ ^^^ + 9 │ > + 10 │ > - This is a long long + + i Add closing triple backticks (```) at the start of a new line. + +ignore-code.md:16:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Unterminated fenced code block, expected closing triple backticks (```). + + 15 │ > - test + > 16 │ > ```md + │ ^^^ + 17 │ > + 18 │ > - This is a long long + + i code block started here + + 15 │ > - test + > 16 │ > ```md + │ ^^^ + 17 │ > + 18 │ > - This is a long long + + i Add closing triple backticks (```) at the start of a new line. + +ignore-code.md:32:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Unterminated fenced code block, expected closing triple backticks (```). + + 30 │ ```` + 31 │ + > 32 │ > ````md + │ ^^^^ + 33 │ > > ```md + 34 │ > > + + i code block started here + + 30 │ ```` + 31 │ + > 32 │ > ````md + │ ^^^^ + 33 │ > > ```md + 34 │ > > + + i Add closing triple backticks (```) at the start of a new line. + +ignore-code.md:48:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Unterminated fenced code block, expected closing triple backticks (```). + + 46 │ >· + 47 │ + > 48 │ > ````js + │ ^^^^ + 49 │ > // biome-ignore format: prettier ignore + 50 │ > const x = 1, + + i code block started here + + 46 │ >· + 47 │ + > 48 │ > ````js + │ ^^^^ + 49 │ > // biome-ignore format: prettier ignore + 50 │ > const x = 1, + + i Add closing triple backticks (```) at the start of a new line. + + +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/blockquote/nested.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/blockquote/nested.md.snap new file mode 100644 index 000000000000..874b8e9d98df --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/blockquote/nested.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/blockquote/nested.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/blockquote/notext-end.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/blockquote/notext-end.md.snap new file mode 100644 index 000000000000..d572aaf84916 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/blockquote/notext-end.md.snap @@ -0,0 +1,82 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/blockquote/notext-end.md +--- +# Input + +```md +> [!NOTE] +> `DOOM` + +> _b_ +>> `A` +>> `B` + +> *a* +>> # 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 +> proseWrap to `never` + +> This is a quote with a link [across multuple lines +> which should just work](). So make sure there is no > if we set +> proseWrap to `never` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -2,15 +2,13 @@ + > `DOOM` + + > _b_ +-> +-> > `A` +-> > `B` ++>> `A` ++>> `B` ++ ++> *a* ++>> # foo ++>> `a` > `b` + +-> _a_ +-> +-> > # 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 +``` + +# Output + +```md +> [!NOTE] +> `DOOM` + +> _b_ +>> `A` +>> `B` + +> *a* +>> # 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 +> proseWrap to `never` + +> This is a quote with a link [across multuple lines +> which should just work](). So make sure there is no > if we set +> proseWrap to `never` +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/broken-plugins/missing-comments.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/broken-plugins/missing-comments.md.snap new file mode 100644 index 000000000000..1da4d19a4647 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/broken-plugins/missing-comments.md.snap @@ -0,0 +1,34 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/broken-plugins/missing-comments.md +--- +# Input + +```md +``````missing-comments + This should not be replaced. +`````` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ +-```missing-comments ++``````missing-comments + This should not be replaced. +-``` ++`````` +``` + +# Output + +```md +``````missing-comments + This should not be replaced. +`````` +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/0-indent-js.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/0-indent-js.md.snap new file mode 100644 index 000000000000..b35df0d4d5c4 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/0-indent-js.md.snap @@ -0,0 +1,70 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/code/0-indent-js.md +--- +# Input + +```md +- 1 + - 2 + - 3 + ```js + md` + # this is the root indent + + # this is the root indent + + # this is the root indent + ` + + something` + asd + + asd + + asd + ` + ``` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,7 +1,6 @@ + - 1 + - 2 + - 3 +- + ```js + md` + # this is the root indent +``` + +# Output + +```md +- 1 + - 2 + - 3 + ```js + md` + # this is the root indent + + # this is the root indent + + # this is the root indent + ` + + something` + asd + + asd + + asd + ` + ``` +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/additional-space.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/additional-space.md.snap new file mode 100644 index 000000000000..0d9d10db257e --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/additional-space.md.snap @@ -0,0 +1,105 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/code/additional-space.md +--- +# Input + +```md +1. Fork the repo and create your branch from `master`. + + Open terminal (e.g. Terminal, iTerm, Git Bash or Git Shell) and type: + ```sh + git clone https://github.com//jest + cd jest + git checkout -b my_branch + ``` + Note: + Replace `` with your GitHub username + +3. Run `yarn install`. + On Windows: + To install [Yarn](https://yarnpkg.com/en/docs/install#windows-tab) on Windows you may need to download either node.js or Chocolatey
+ + ```sh + yarn install + ``` + To check your version of Yarn and ensure it's installed you can type: + ```sh + yarn --version + ``` +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,26 +1,22 @@ + 1. Fork the repo and create your branch from `master`. + + Open terminal (e.g. Terminal, iTerm, Git Bash or Git Shell) and type: +- + ```sh + git clone https://github.com//jest + cd jest + git checkout -b my_branch + ``` +- + Note: + Replace `` with your GitHub username + +-2. Run `yarn install`. ++3. Run `yarn install`. + On Windows: + To install [Yarn](https://yarnpkg.com/en/docs/install#windows-tab) on Windows you may need to download either node.js or Chocolatey
+ +- ```sh +- yarn install +- ``` +- +- To check your version of Yarn and ensure it's installed you can type: +- +- ```sh +- yarn --version +- ``` ++ ```sh ++ yarn install ++ ``` ++ To check your version of Yarn and ensure it's installed you can type: ++ ```sh ++ yarn --version ++ ``` +\ No newline at end of file +``` + +# Output + +```md +1. Fork the repo and create your branch from `master`. + + Open terminal (e.g. Terminal, iTerm, Git Bash or Git Shell) and type: + ```sh + git clone https://github.com//jest + cd jest + git checkout -b my_branch + ``` + Note: + Replace `` with your GitHub username + +3. Run `yarn install`. + On Windows: + To install [Yarn](https://yarnpkg.com/en/docs/install#windows-tab) on Windows you may need to download either node.js or Chocolatey
+ + ```sh + yarn install + ``` + To check your version of Yarn and ensure it's installed you can type: + ```sh + yarn --version + `````` + +# Lines exceeding max width of 80 characters +``` + 14: To install [Yarn](https://yarnpkg.com/en/docs/install#windows-tab) on Windows you may need to download either node.js or Chocolatey
+``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/angular/angular-html.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/angular/angular-html.md.snap new file mode 100644 index 000000000000..3b0641b6e819 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/angular/angular-html.md.snap @@ -0,0 +1,57 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/code/angular/angular-html.md +--- +# Input + +```md +```angular-html +@if (orderForm.couponCode().disabled()) { +
+ @for (reason of orderForm.couponCode().disabledReasons(); track reason) { +

{{ reason.message }}

+ }
+ } +``` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,9 +1,8 @@ + ```angular-html + @if (orderForm.couponCode().disabled()) { +-
+- @for (reason of orderForm.couponCode().disabledReasons(); track reason) { +-

{{ reason.message }}

++
++ @for (reason of orderForm.couponCode().disabledReasons(); track reason) { ++

{{ reason.message }}

++ }
+ } +-
+-} + ``` +``` + +# Output + +```md +```angular-html +@if (orderForm.couponCode().disabled()) { +
+ @for (reason of orderForm.couponCode().disabledReasons(); track reason) { +

{{ reason.message }}

+ }
+ } +``` +``` + +# Lines exceeding max width of 80 characters +``` + 4: @for (reason of orderForm.couponCode().disabledReasons(); track reason) { +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/angular/angular-ts.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/angular/angular-ts.md.snap new file mode 100644 index 000000000000..21c2f3c3c55c --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/angular/angular-ts.md.snap @@ -0,0 +1,94 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/code/angular/angular-ts.md +--- +# Input + +```md +```angular-ts +type A ={ + Ugly:string +} + +@Component({template: ` +@if (orderForm.couponCode().disabled()) { +
+ @for (reason of orderForm.couponCode().disabledReasons(); track reason) { +

{{ reason.message }}

+ }
+ } + ` +}) +export class Order { +} +``` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,21 +1,17 @@ + ```angular-ts +-type A = { +- Ugly: string; +-}; ++type A ={ ++ Ugly:string ++} + +-@Component({ +- template: ` +- @if (orderForm.couponCode().disabled()) { ++@Component({template: ` ++@if (orderForm.couponCode().disabled()) { +
+- @for ( +- reason of orderForm.couponCode().disabledReasons(); +- track reason +- ) { +-

{{ reason.message }}

+- } +-
++ @for (reason of orderForm.couponCode().disabledReasons(); track reason) { ++

{{ reason.message }}

++ } + } +- `, ++ ` + }) +-export class Order {} ++export class Order { ++} + ``` +``` + +# Output + +```md +```angular-ts +type A ={ + Ugly:string +} + +@Component({template: ` +@if (orderForm.couponCode().disabled()) { +
+ @for (reason of orderForm.couponCode().disabledReasons(); track reason) { +

{{ reason.message }}

+ }
+ } + ` +}) +export class Order { +} +``` +``` + +# Lines exceeding max width of 80 characters +``` + 9: @for (reason of orderForm.couponCode().disabledReasons(); track reason) { +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/backtick.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/backtick.md.snap new file mode 100644 index 000000000000..96124a3a48fd --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/backtick.md.snap @@ -0,0 +1,46 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/code/backtick.md +--- +# Input + +```md +`````````` + +```js +console.log("hello world!"); +``` + +`````````` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,7 +1,7 @@ +-```` ++`````````` + + ```js + console.log("hello world!"); + ``` + +-```` ++`````````` +``` + +# Output + +```md +`````````` + +```js +console.log("hello world!"); +``` + +`````````` +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/indent.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/indent.md.snap new file mode 100644 index 000000000000..756fdb615ee7 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/indent.md.snap @@ -0,0 +1,81 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/code/indent.md +--- +# Input + +```md + Indented Code Block + Indented Code Block + Indented Code Block + Indented Code Block + Indented Code Block + +- ``` + Fenced Code Block + Fenced Code Block + Fenced Code Block + Fenced Code Block + Fenced Code Block + ``` + + + +1. Change to your home directory: + + cd + +2. List the contents: + + ls -l + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -14,10 +14,10 @@ + + + +-1. Change to your home directory: ++1. Change to your home directory: + + cd + +-2. List the contents: ++2. List the contents: + + ls -l +``` + +# Output + +```md + Indented Code Block + Indented Code Block + Indented Code Block + Indented Code Block + Indented Code Block + +- ``` + Fenced Code Block + Fenced Code Block + Fenced Code Block + Fenced Code Block + Fenced Code Block + ``` + + + +1. Change to your home directory: + + cd + +2. List the contents: + + ls -l +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-auth-api.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-auth-api.md.snap new file mode 100644 index 000000000000..a897ad2207b2 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-auth-api.md.snap @@ -0,0 +1,102 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/code/mdn-auth-api.md +--- +# Input + +```md + + + +```javascript + + +// sample arguments for registration +const createCredentialDefaultArgs = { + publicKey: { + // Relying Party (a.k.a. - Service): + rp: { + name: "Acme", }, + // User: + user: { + id: new Uint8Array(16), + name: "carina.p.anand@example.com", displayName: "Carina P. Anand", + }, + pubKeyCredParams: [ + { + type: "public-key", + alg: -7, + }, + ], + attestation: "direct", + timeout: 60000, + challenge: new Uint8Array( +[ + // must be a cryptographically random number sent from a server + 0x8c, 0x0a, 0x26, 0xff, 0x22, 0x91, 0xc1, 0xe9, 0xb9, 0x4e, 0x2e, 0x17, 0x1a, 0x98, 0x6a, 0x73, 0x71, 0x9d, 0x43, 0x48, 0xd5, 0xa7, 0x6a, 0x15, 0x7e, 0x38, + 0x94, 0x52, 0x77, 0x97, 0x0f, 0xef, + ]).buffer, + }, +}; +``` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,6 @@ ++ ++ ++ + ```javascript + + +``` + +# Output + +```md + + + +```javascript + + +// sample arguments for registration +const createCredentialDefaultArgs = { + publicKey: { + // Relying Party (a.k.a. - Service): + rp: { + name: "Acme", }, + // User: + user: { + id: new Uint8Array(16), + name: "carina.p.anand@example.com", displayName: "Carina P. Anand", + }, + pubKeyCredParams: [ + { + type: "public-key", + alg: -7, + }, + ], + attestation: "direct", + timeout: 60000, + challenge: new Uint8Array( +[ + // must be a cryptographically random number sent from a server + 0x8c, 0x0a, 0x26, 0xff, 0x22, 0x91, 0xc1, 0xe9, 0xb9, 0x4e, 0x2e, 0x17, 0x1a, 0x98, 0x6a, 0x73, 0x71, 0x9d, 0x43, 0x48, 0xd5, 0xa7, 0x6a, 0x15, 0x7e, 0x38, + 0x94, 0x52, 0x77, 0x97, 0x0f, 0xef, + ]).buffer, + }, +}; +``` +``` + +# Lines exceeding max width of 80 characters +``` + 29: 0x8c, 0x0a, 0x26, 0xff, 0x22, 0x91, 0xc1, 0xe9, 0xb9, 0x4e, 0x2e, 0x17, 0x1a, 0x98, 0x6a, 0x73, 0x71, 0x9d, 0x43, 0x48, 0xd5, 0xa7, 0x6a, 0x15, 0x7e, 0x38, +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-background-1.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-background-1.md.snap new file mode 100644 index 000000000000..8ca76c033ec7 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-background-1.md.snap @@ -0,0 +1,64 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/code/mdn-background-1.md +--- +# Input + +```md + + + +```css + +.box { + background: + linear-gradient( + 105deg, + rgb(255 255 255 / 20%) 39%, + rgb(51 56 57 / 100%) 96% + ) center center / 400px 200px no-repeat, url(big-star.png) center no-repeat, + rebeccapurple; +} +``` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,6 @@ ++ ++ ++ + ```css + + .box { +``` + +# Output + +```md + + + +```css + +.box { + background: + linear-gradient( + 105deg, + rgb(255 255 255 / 20%) 39%, + rgb(51 56 57 / 100%) 96% + ) center center / 400px 200px no-repeat, url(big-star.png) center no-repeat, + rebeccapurple; +} +``` +``` + +# Lines exceeding max width of 80 characters +``` + 12: ) center center / 400px 200px no-repeat, url(big-star.png) center no-repeat, +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-background-2.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-background-2.md.snap new file mode 100644 index 000000000000..477cc15ce339 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-background-2.md.snap @@ -0,0 +1,49 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/code/mdn-background-2.md +--- +# Input + +```md + +```css + + + +background-image: linear-gradient( + to bottom, + rgb(255 255 0 / 50%), + rgb(0 0 255 / 50%) + ), url("catfront.png"); +``` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,4 @@ ++ + ```css + + +``` + +# Output + +```md + +```css + + + +background-image: linear-gradient( + to bottom, + rgb(255 255 0 / 50%), + rgb(0 0 255 / 50%) + ), url("catfront.png"); +``` +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-background-3.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-background-3.md.snap new file mode 100644 index 000000000000..999327b8be38 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-background-3.md.snap @@ -0,0 +1,64 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/code/mdn-background-3.md +--- +# Input + +```md + +```css + +.box { + margin: 10px 0; + color: #fff; + background: linear-gradient(90deg, + rgb(131 58 180 / 100%) 0%, + rgb(253 29 29 / 60%) 60%, rgb(252 176 69 / 100%) 100%), radial-gradient(circle, rgb(255 255 255 / 100%) 0%, rgb(0 0 0 / 100%) 28%); + border: 20px dashed black; + padding: 20px; +width: 400px; + background-origin: padding-box, content-box; + background-repeat: no-repeat; +} +``` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,4 @@ ++ + ```css + + .box { +``` + +# Output + +```md + +```css + +.box { + margin: 10px 0; + color: #fff; + background: linear-gradient(90deg, + rgb(131 58 180 / 100%) 0%, + rgb(253 29 29 / 60%) 60%, rgb(252 176 69 / 100%) 100%), radial-gradient(circle, rgb(255 255 255 / 100%) 0%, rgb(0 0 0 / 100%) 28%); + border: 20px dashed black; + padding: 20px; +width: 400px; + background-origin: padding-box, content-box; + background-repeat: no-repeat; +} +``` +``` + +# Lines exceeding max width of 80 characters +``` + 9: rgb(253 29 29 / 60%) 60%, rgb(252 176 69 / 100%) 100%), radial-gradient(circle, rgb(255 255 255 / 100%) 0%, rgb(0 0 0 / 100%) 28%); +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-background-4.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-background-4.md.snap new file mode 100644 index 000000000000..38ddc3a2df48 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-background-4.md.snap @@ -0,0 +1,62 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/code/mdn-background-4.md +--- +# Input + +```md + +```css + + +.multi-bg-example { + width: 100%; height: 400px; + background-image: url(firefox.png), url(bubbles.png), linear-gradient(to right, rgb(30 + 75 115 / 100%), rgb(255 255 255 / 0%)); + background-repeat: no-repeat, no-repeat, no-repeat; +background-position: + bottom right, + left, + right; +} +``` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,4 @@ ++ + ```css + + +``` + +# Output + +```md + +```css + + +.multi-bg-example { + width: 100%; height: 400px; + background-image: url(firefox.png), url(bubbles.png), linear-gradient(to right, rgb(30 + 75 115 / 100%), rgb(255 255 255 / 0%)); + background-repeat: no-repeat, no-repeat, no-repeat; +background-position: + bottom right, + left, + right; +} +``` +``` + +# Lines exceeding max width of 80 characters +``` + 7: background-image: url(firefox.png), url(bubbles.png), linear-gradient(to right, rgb(30 +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-background-5.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-background-5.md.snap new file mode 100644 index 000000000000..13ad340d751f --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-background-5.md.snap @@ -0,0 +1,54 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/code/mdn-background-5.md +--- +# Input + +```md + + +```css + +.stacked-linear { + background: linear-gradient( + 217deg, + rgb(255 0 0 / 80%), + rgb(255 0 0 / 0%) 70.71% + ), linear-gradient(127deg, rgb(0 255 0 / 80%), rgb(0 255 0 / 0%) 70.71%), + linear-gradient(336deg, rgb(0 0 255 / 80%), rgb(0 0 255 / 0%) 70.71%); +} +``` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,5 @@ ++ ++ + ```css + + .stacked-linear { +``` + +# Output + +```md + + +```css + +.stacked-linear { + background: linear-gradient( + 217deg, + rgb(255 0 0 / 80%), + rgb(255 0 0 / 0%) 70.71% + ), linear-gradient(127deg, rgb(0 255 0 / 80%), rgb(0 255 0 / 0%) 70.71%), + linear-gradient(336deg, rgb(0 0 255 / 80%), rgb(0 0 255 / 0%) 70.71%); +} +``` +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-background-6.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-background-6.md.snap new file mode 100644 index 000000000000..92fe036550ad --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-background-6.md.snap @@ -0,0 +1,77 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/code/mdn-background-6.md +--- +# Input + +```md + +```css + + + +.stacked-radial { + background: + radial-gradient( + circle at 50% 0, + rgb(255 0 0 / 50%), + rgb(255 0 0 / 0%) 70.71% + ), + radial-gradient( + circle at 6.7% 75%, + rgb(0 0 255 / 50%), + rgb(0 0 255 / 0%) 70.71% + ), + radial-gradient( + circle at 93.3% 75%, + rgb(0 255 0 / 50%), + rgb(0 255 0 / 0%) 70.71% + ) beige; + border-radius: 50%; +} +``` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,4 @@ ++ + ```css + + +``` + +# Output + +```md + +```css + + + +.stacked-radial { + background: + radial-gradient( + circle at 50% 0, + rgb(255 0 0 / 50%), + rgb(255 0 0 / 0%) 70.71% + ), + radial-gradient( + circle at 6.7% 75%, + rgb(0 0 255 / 50%), + rgb(0 0 255 / 0%) 70.71% + ), + radial-gradient( + circle at 93.3% 75%, + rgb(0 255 0 / 50%), + rgb(0 255 0 / 0%) 70.71% + ) beige; + border-radius: 50%; +} +``` +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-background-7.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-background-7.md.snap new file mode 100644 index 000000000000..dbdf9cc1fe9a --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-background-7.md.snap @@ -0,0 +1,91 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/code/mdn-background-7.md +--- +# Input + +```md + + +```css + +.multi-repeating-linear { + background: repeating-linear-gradient( + 190deg, + rgb(255 0 0 / 50%) 40px, + rgb(255 153 0 / 50%) 80px, +rgb(255 255 0 / 50%) 120px, + rgb(0 255 0 / 50%) 160px, + rgb(0 0 255 / 50%) 200px, + rgb(75 0 130 / 50%) 240px, + rgb(238 130 238 / 50%) 280px, + rgb(255 0 0 / 50%) 300px + ), repeating-linear-gradient( + -190deg, + rgb(255 0 0 / 50%) 30px, + rgb(255 153 0 / 50%) 60px, + rgb(255 255 0 / 50%) 90px, + rgb(0 255 0 / 50%) 120px, + rgb(0 0 255 / 50%) 150px, + rgb(75 0 130 / 50%) 180px, + rgb(238 130 238 / 50%) 210px, + rgb(255 0 0 / 50%) 230px + ), repeating-linear-gradient(23deg, red 50px, orange 100px, yellow 150px, green + 200px, blue 250px, indigo 300px, violet 350px, red 370px); +} +``` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,5 @@ ++ ++ + ```css + + .multi-repeating-linear { +``` + +# Output + +```md + + +```css + +.multi-repeating-linear { + background: repeating-linear-gradient( + 190deg, + rgb(255 0 0 / 50%) 40px, + rgb(255 153 0 / 50%) 80px, +rgb(255 255 0 / 50%) 120px, + rgb(0 255 0 / 50%) 160px, + rgb(0 0 255 / 50%) 200px, + rgb(75 0 130 / 50%) 240px, + rgb(238 130 238 / 50%) 280px, + rgb(255 0 0 / 50%) 300px + ), repeating-linear-gradient( + -190deg, + rgb(255 0 0 / 50%) 30px, + rgb(255 153 0 / 50%) 60px, + rgb(255 255 0 / 50%) 90px, + rgb(0 255 0 / 50%) 120px, + rgb(0 0 255 / 50%) 150px, + rgb(75 0 130 / 50%) 180px, + rgb(238 130 238 / 50%) 210px, + rgb(255 0 0 / 50%) 230px + ), repeating-linear-gradient(23deg, red 50px, orange 100px, yellow 150px, green + 200px, blue 250px, indigo 300px, violet 350px, red 370px); +} +``` +``` + +# Lines exceeding max width of 80 characters +``` + 26: ), repeating-linear-gradient(23deg, red 50px, orange 100px, yellow 150px, green +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-background-8.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-background-8.md.snap new file mode 100644 index 000000000000..089c9a7b4165 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-background-8.md.snap @@ -0,0 +1,167 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/code/mdn-background-8.md +--- +# Input + +```md + + +```css + +.plaid-gradient { + background: repeating-linear-gradient( + 90deg, + transparent, + transparent 50px, + rgb(255 127 0 / 25%) 50px, + rgb(255 127 0 / 25%) 56px, + transparent 56px, + transparent 63px, + rgb(255 127 0 / 25%) 63px, + rgb(255 127 0 / 25%) 69px, +transparent 69px, + transparent 116px, + rgb(255 206 0 / 25%) 116px, + rgb(255 206 0 / 25%) 166px + ), repeating-linear-gradient( + 0deg, + transparent, + transparent 50px, + rgb(255 127 0 / 25%) 50px, + rgb(255 127 0 / 25%) 56px, + transparent 56px, + transparent 63px, + rgb(255 127 0 / 25%) 63px, + rgb(255 127 0 / 25%) 69px, + transparent 69px, + transparent 116px, + rgb(255 206 0 / 25%) 116px, + rgb(255 206 0 / 25%) 166px + ), repeating-linear-gradient( + -45deg, + transparent, + transparent 5px, + rgb(143 77 63 / 25%) 5px, + rgb(143 77 63 / 25%) 10px + ), repeating-linear-gradient(45deg, transparent, transparent 5px, rgb( + 143 77 63 / 25% + ) 5px, rgb(143 77 63 / 25%) 10px); + + background: repeating-linear-gradient( + 90deg, + transparent 0 50px, + rgb(255 127 0 / 25%) 50px 56px, + transparent 56px 63px, + rgb(255 127 0 / 25%) 63px 69px, + transparent 69px 116px, + rgb(255 206 0 / 25%) 116px 166px + ), repeating-linear-gradient( + 0deg, + transparent 0 50px, + rgb(255 127 0 / 25%) 50px 56px, + transparent 56px 63px, + rgb(255 127 0 / 25%) 63px 69px, + transparent 69px 116px, + rgb(255 206 0 / 25%) 116px 166px + ), repeating-linear-gradient( + -45deg, + transparent 0 5px, + rgb(143 77 63 / 25%) 5px 10px + ), repeating-linear-gradient(45deg, transparent 0 5px, rgb(143 77 63 / 25%) 5px + 10px); +} +``` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,5 @@ ++ ++ + ```css + + .plaid-gradient { +``` + +# Output + +```md + + +```css + +.plaid-gradient { + background: repeating-linear-gradient( + 90deg, + transparent, + transparent 50px, + rgb(255 127 0 / 25%) 50px, + rgb(255 127 0 / 25%) 56px, + transparent 56px, + transparent 63px, + rgb(255 127 0 / 25%) 63px, + rgb(255 127 0 / 25%) 69px, +transparent 69px, + transparent 116px, + rgb(255 206 0 / 25%) 116px, + rgb(255 206 0 / 25%) 166px + ), repeating-linear-gradient( + 0deg, + transparent, + transparent 50px, + rgb(255 127 0 / 25%) 50px, + rgb(255 127 0 / 25%) 56px, + transparent 56px, + transparent 63px, + rgb(255 127 0 / 25%) 63px, + rgb(255 127 0 / 25%) 69px, + transparent 69px, + transparent 116px, + rgb(255 206 0 / 25%) 116px, + rgb(255 206 0 / 25%) 166px + ), repeating-linear-gradient( + -45deg, + transparent, + transparent 5px, + rgb(143 77 63 / 25%) 5px, + rgb(143 77 63 / 25%) 10px + ), repeating-linear-gradient(45deg, transparent, transparent 5px, rgb( + 143 77 63 / 25% + ) 5px, rgb(143 77 63 / 25%) 10px); + + background: repeating-linear-gradient( + 90deg, + transparent 0 50px, + rgb(255 127 0 / 25%) 50px 56px, + transparent 56px 63px, + rgb(255 127 0 / 25%) 63px 69px, + transparent 69px 116px, + rgb(255 206 0 / 25%) 116px 166px + ), repeating-linear-gradient( + 0deg, + transparent 0 50px, + rgb(255 127 0 / 25%) 50px 56px, + transparent 56px 63px, + rgb(255 127 0 / 25%) 63px 69px, + transparent 69px 116px, + rgb(255 206 0 / 25%) 116px 166px + ), repeating-linear-gradient( + -45deg, + transparent 0 5px, + rgb(143 77 63 / 25%) 5px 10px + ), repeating-linear-gradient(45deg, transparent 0 5px, rgb(143 77 63 / 25%) 5px + 10px); +} +``` +``` + +# Lines exceeding max width of 80 characters +``` + 64: ), repeating-linear-gradient(45deg, transparent 0 5px, rgb(143 77 63 / 25%) 5px +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-background-9.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-background-9.md.snap new file mode 100644 index 000000000000..69c7615f3ffa --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-background-9.md.snap @@ -0,0 +1,55 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/code/mdn-background-9.md +--- +# Input + +```md + +```css + + +div { + background: conic-gradient( + #fff 0.25turn, + #000 0.25turn 0.5turn, + #fff 0.5turn 0.75turn, + #000 0.75turn + ) top left / 25% 25% repeat; + border: 1px solid; +} +``` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,4 @@ ++ + ```css + + +``` + +# Output + +```md + +```css + + +div { + background: conic-gradient( + #fff 0.25turn, + #000 0.25turn 0.5turn, + #fff 0.5turn 0.75turn, + #000 0.75turn + ) top left / 25% 25% repeat; + border: 1px solid; +} +``` +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-filter-1.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-filter-1.md.snap new file mode 100644 index 000000000000..2e4c3b259907 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-filter-1.md.snap @@ -0,0 +1,58 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/code/mdn-filter-1.md +--- +# Input + +```md + +```css + +img { + filter: drop-shadow(2px 2px 0 hsl(300deg 100% 50%)) drop-shadow( + -2px -2px 0 hsl(210deg 100% 50%) ) drop-shadow(2px 2px 0 hsl(120deg 100% 50%)) drop-shadow( + -2px -2px 0 hsl(30deg 100% 50%) + ); +} +img + img { +filter: none; +} +``` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,4 @@ ++ + ```css + + img { +``` + +# Output + +```md + +```css + +img { + filter: drop-shadow(2px 2px 0 hsl(300deg 100% 50%)) drop-shadow( + -2px -2px 0 hsl(210deg 100% 50%) ) drop-shadow(2px 2px 0 hsl(120deg 100% 50%)) drop-shadow( + -2px -2px 0 hsl(30deg 100% 50%) + ); +} +img + img { +filter: none; +} +``` +``` + +# Lines exceeding max width of 80 characters +``` + 6: -2px -2px 0 hsl(210deg 100% 50%) ) drop-shadow(2px 2px 0 hsl(120deg 100% 50%)) drop-shadow( +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-filter-2.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-filter-2.md.snap new file mode 100644 index 000000000000..adc99dd60780 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-filter-2.md.snap @@ -0,0 +1,49 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/code/mdn-filter-2.md +--- +# Input + +```md + +```css + + + +#MDN-logo { +border: 1px solid blue; + filter: drop-shadow(5px 5px 0 red) hue-rotate(180deg) drop-shadow(5px 5px 0 + red); +} +``` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,4 @@ ++ + ```css + + +``` + +# Output + +```md + +```css + + + +#MDN-logo { +border: 1px solid blue; + filter: drop-shadow(5px 5px 0 red) hue-rotate(180deg) drop-shadow(5px 5px 0 + red); +} +``` +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-font-face-1.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-font-face-1.md.snap new file mode 100644 index 000000000000..ee598e8c3f27 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-font-face-1.md.snap @@ -0,0 +1,66 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/code/mdn-font-face-1.md +--- +# Input + +```md + + + +```css + +@font-face { + font-family: "HeydingsControlsRegular"; + src: url("fonts/heydings_controls-webfont.eot"); + src: + url("fonts/heydings_controls-webfont.eot?#iefix") format("embedded-opentype"), +url("fonts/heydings_controls-webfont.woff") format("woff"), + url("fonts/heydings_controls-webfont.ttf") format("truetype"); + font-weight: normal; +font-style: normal; +} +``` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,6 @@ ++ ++ ++ + ```css + + @font-face { +``` + +# Output + +```md + + + +```css + +@font-face { + font-family: "HeydingsControlsRegular"; + src: url("fonts/heydings_controls-webfont.eot"); + src: + url("fonts/heydings_controls-webfont.eot?#iefix") format("embedded-opentype"), +url("fonts/heydings_controls-webfont.woff") format("woff"), + url("fonts/heydings_controls-webfont.ttf") format("truetype"); + font-weight: normal; +font-style: normal; +} +``` +``` + +# Lines exceeding max width of 80 characters +``` + 10: url("fonts/heydings_controls-webfont.eot?#iefix") format("embedded-opentype"), +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-font-face-2.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-font-face-2.md.snap new file mode 100644 index 000000000000..48989b0a1625 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-font-face-2.md.snap @@ -0,0 +1,61 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/code/mdn-font-face-2.md +--- +# Input + +```md + + +```css + + + + + +@font-face { + font-family: "Bungee Spice"; + src: + url("https://fonts.googleapis.com/css2?family=Bungee+Spice") tech(color-COLRv1), url("Bungee-fallback.otf") format("opentype"); +} +``` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,5 @@ ++ ++ + ```css + + +``` + +# Output + +```md + + +```css + + + + + +@font-face { + font-family: "Bungee Spice"; + src: + url("https://fonts.googleapis.com/css2?family=Bungee+Spice") tech(color-COLRv1), url("Bungee-fallback.otf") format("opentype"); +} +``` +``` + +# Lines exceeding max width of 80 characters +``` + 12: url("https://fonts.googleapis.com/css2?family=Bungee+Spice") tech(color-COLRv1), url("Bungee-fallback.otf") format("opentype"); +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-grid-auto-columns.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-grid-auto-columns.md.snap new file mode 100644 index 000000000000..a292645515af --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-grid-auto-columns.md.snap @@ -0,0 +1,55 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/code/mdn-grid-auto-columns.md +--- +# Input + +```md + +```css + +/* multiple track-size values */ +grid-auto-columns: min-content max-content auto; +grid-auto-columns: 100px 150px 390px; +grid-auto-columns: 10% 33.3%; +grid-auto-columns: 0.5fr 3fr 1fr; +grid-auto-columns: minmax(100px, auto) minmax(max-content, 2fr) minmax(20%, 80vmax); +grid-auto-columns: 100px minmax(100px, auto) 10% 0.5fr fit-content(400px); +``` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,4 @@ ++ + ```css + + /* multiple track-size values */ +``` + +# Output + +```md + +```css + +/* multiple track-size values */ +grid-auto-columns: min-content max-content auto; +grid-auto-columns: 100px 150px 390px; +grid-auto-columns: 10% 33.3%; +grid-auto-columns: 0.5fr 3fr 1fr; +grid-auto-columns: minmax(100px, auto) minmax(max-content, 2fr) minmax(20%, 80vmax); +grid-auto-columns: 100px minmax(100px, auto) 10% 0.5fr fit-content(400px); +``` +``` + +# Lines exceeding max width of 80 characters +``` + 9: grid-auto-columns: minmax(100px, auto) minmax(max-content, 2fr) minmax(20%, 80vmax); + 10: grid-auto-columns: 100px minmax(100px, auto) 10% 0.5fr fit-content(400px); +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-import.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-import.md.snap new file mode 100644 index 000000000000..dd252f6659b4 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-import.md.snap @@ -0,0 +1,54 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/code/mdn-import.md +--- +# Input + +```md + + +```css + + +@import url("gridy.css") supports( display: grid) screen and (max-width: 400px); +@import url("flexy.css") supports(not (display: grid ) and (display: flex)) screen and (max-width: 400px); +@import url( +"whatever.css") supports((selector(h2 > p)) and (font-tech(color-COLRv1))); +``` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,5 @@ ++ ++ + ```css + + +``` + +# Output + +```md + + +```css + + +@import url("gridy.css") supports( display: grid) screen and (max-width: 400px); +@import url("flexy.css") supports(not (display: grid ) and (display: flex)) screen and (max-width: 400px); +@import url( +"whatever.css") supports((selector(h2 > p)) and (font-tech(color-COLRv1))); +``` +``` + +# Lines exceeding max width of 80 characters +``` + 6: @import url("gridy.css") supports( display: grid) screen and (max-width: 400px); + 7: @import url("flexy.css") supports(not (display: grid ) and (display: flex)) screen and (max-width: 400px); +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-mask-image.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-mask-image.md.snap new file mode 100644 index 000000000000..ffb80db9d7a9 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-mask-image.md.snap @@ -0,0 +1,44 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/code/mdn-mask-image.md +--- +# Input + +```md + +```css + +/* Multiple values */ +mask-image: image(url(mask.png), skyblue), linear-gradient(rgb(0 0 0 / 100%), transparent); +``` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,4 @@ ++ + ```css + + /* Multiple values */ +``` + +# Output + +```md + +```css + +/* Multiple values */ +mask-image: image(url(mask.png), skyblue), linear-gradient(rgb(0 0 0 / 100%), transparent); +``` +``` + +# Lines exceeding max width of 80 characters +``` + 5: mask-image: image(url(mask.png), skyblue), linear-gradient(rgb(0 0 0 / 100%), transparent); +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-padding-1.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-padding-1.md.snap new file mode 100644 index 000000000000..f185150b4f9c --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-padding-1.md.snap @@ -0,0 +1,50 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/code/mdn-padding-1.md +--- +# Input + +```md + + +```css + +body { +padding: env(safe-area-inset-top, 20px) env(safe-area-inset-right, 20px) env( + safe-area-inset-bottom, + 20px + ) env(safe-area-inset-left, 20px); +} +``` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,5 @@ ++ ++ + ```css + + body { +``` + +# Output + +```md + + +```css + +body { +padding: env(safe-area-inset-top, 20px) env(safe-area-inset-right, 20px) env( + safe-area-inset-bottom, + 20px + ) env(safe-area-inset-left, 20px); +} +``` +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-padding-2.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-padding-2.md.snap new file mode 100644 index 000000000000..d089a40f6dc1 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-padding-2.md.snap @@ -0,0 +1,59 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/code/mdn-padding-2.md +--- +# Input + +```md + + +```css + +p { + width: 300px; + border: 2px solid red; + padding: env(safe-area-inset-top, 50px) env(safe-area-inset-right, 50px) env( + safe-area-inset-bottom, + 50px + ) env(SAFE-AREA-INSET-LEFT, 50px); +} +``` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,5 @@ ++ ++ + ```css + + p { +``` + +# Output + +```md + + +```css + +p { + width: 300px; + border: 2px solid red; + padding: env(safe-area-inset-top, 50px) env(safe-area-inset-right, 50px) env( + safe-area-inset-bottom, + 50px + ) env(SAFE-AREA-INSET-LEFT, 50px); +} +``` +``` + +# Lines exceeding max width of 80 characters +``` + 8: padding: env(safe-area-inset-top, 50px) env(safe-area-inset-right, 50px) env( +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-transform.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-transform.md.snap new file mode 100644 index 000000000000..ecfc637f531d --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-transform.md.snap @@ -0,0 +1,75 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/code/mdn-transform.md +--- +# Input + +```md + +```css + +#example-element:focus { + transform: rotate3d(1, 1, 1, 30deg) matrix3d( + 1, + 0, + 0, + 0, + 0, + 1, + 6, + 0, + 0, + 0, + 1, + 0, + 50, + 100, + 0, + 1.1 + ); +} +``` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,4 @@ ++ + ```css + + #example-element:focus { +``` + +# Output + +```md + +```css + +#example-element:focus { + transform: rotate3d(1, 1, 1, 30deg) matrix3d( + 1, + 0, + 0, + 0, + 0, + 1, + 6, + 0, + 0, + 0, + 1, + 0, + 50, + 100, + 0, + 1.1 + ); +} +``` +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-unicode-range.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-unicode-range.md.snap new file mode 100644 index 000000000000..084bb3435b17 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/code/mdn-unicode-range.md.snap @@ -0,0 +1,76 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/code/mdn-unicode-range.md +--- +# Input + +```md + + +```css + + + +@media (prefers-reduced-data: no-preference) { + @font-face { + font-family: Montserrat; + font-style: normal; + font-weight: 400; + font-display: swap; + /* latin */ + src: + local("Montserrat Regular"), + local("Montserrat-Regular"), + url("fonts/montserrat-regular.woff2") format("woff2"); + unicode-range: U+0000-00FF, U+0131, +U+0152-0153, U+02BB-02BC, U+02C6, + U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, + U+2212, U+2215, U+FEFF, U+FFFD; + } +} +``` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,5 @@ ++ ++ + ```css + + +``` + +# Output + +```md + + +```css + + + +@media (prefers-reduced-data: no-preference) { + @font-face { + font-family: Montserrat; + font-style: normal; + font-weight: 400; + font-display: swap; + /* latin */ + src: + local("Montserrat Regular"), + local("Montserrat-Regular"), + url("fonts/montserrat-regular.woff2") format("woff2"); + unicode-range: U+0000-00FF, U+0131, +U+0152-0153, U+02BB-02BC, U+02C6, + U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, + U+2212, U+2215, U+FEFF, U+FFFD; + } +} +``` +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/cursor/17227.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/cursor/17227.md.snap new file mode 100644 index 000000000000..b98662a7709b --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/cursor/17227.md.snap @@ -0,0 +1,98 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/cursor/17227.md +--- +# Input + +```md +# Angular note + +```typescript + import {Component} from '@angular/core'; + + @Component({ + selector: 'app-root', + standalone: true, + imports: [], + template: ` +

+ + {{ title }}

+ `, + styleUrls: ['./app.component.css'], + }) + export class AppComponent { + title = 'default'; + } +``` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,20 +1,20 @@ + # Angular note + + ```typescript +-import { Component } from "@angular/core"; ++ import {Component} from '@angular/core'; + +-@Component({ +- selector: "app-root", +- standalone: true, +- imports: [], +- template: ` +-

+- {{ title }} +-

+- `, +- styleUrls: ["./app.component.css"], +-}) +-export class AppComponent { +- title = "default"; +-} ++ @Component({ ++ selector: 'app-root', ++ standalone: true, ++ imports: [], ++ template: ` ++

++ ++ {{ title }}

++ `, ++ styleUrls: ['./app.component.css'], ++ }) ++ export class AppComponent { ++ title = 'default'; ++ } + ``` +``` + +# Output + +```md +# Angular note + +```typescript + import {Component} from '@angular/core'; + + @Component({ + selector: 'app-root', + standalone: true, + imports: [], + template: ` +

+ + {{ title }}

+ `, + styleUrls: ['./app.component.css'], + }) + export class AppComponent { + title = 'default'; + } +``` +``` 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 new file mode 100644 index 000000000000..2bd255bc6422 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/emphasis/asterisk.md.snap @@ -0,0 +1,27 @@ +--- +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 new file mode 100644 index 000000000000..8e58bcbbcd0e --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/emphasis/complex.md.snap @@ -0,0 +1,34 @@ +--- +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 new file mode 100644 index 000000000000..2c7644379082 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/emphasis/special.md.snap @@ -0,0 +1,132 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/emphasis/special.md +--- +# Input + +```md +0*1*2 + +!*1*2 + +0*1*! + +!*1*! + +0*1*2 + +!*1*2 + +0*1*! + +!*1*! + +0_1_2 + +!_1_2 + +0_1_! + +!_1_! + +0_1_2 + +!_1_2 + +0_1_! + +!_1_! + +1***2***3 + +1 ***2*** 3 + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -4,7 +4,7 @@ + + 0*1*! + +-!_1_! ++!*1*! + + 0*1*2 + +@@ -12,24 +12,24 @@ + + 0*1*! + +-!_1_! ++!*1*! + + 0_1_2 + +-!\_1_2 ++!_1_2 + +-0*1*! ++0_1_! + + !_1_! + + 0_1_2 + +-!\_1_2 ++!_1_2 + +-0*1*! ++0_1_! + + !_1_! + + 1***2***3 + +-1 **_2_** 3 ++1 ***2*** 3 +``` + +# Output + +```md +0*1*2 + +!*1*2 + +0*1*! + +!*1*! + +0*1*2 + +!*1*2 + +0*1*! + +!*1*! + +0_1_2 + +!_1_2 + +0_1_! + +!_1_! + +0_1_2 + +!_1_2 + +0_1_! + +!_1_! + +1***2***3 + +1 ***2*** 3 +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/footnoteDefinition/long.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/footnoteDefinition/long.md.snap new file mode 100644 index 000000000000..e9aa3022e2a0 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/footnoteDefinition/long.md.snap @@ -0,0 +1,43 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/footnoteDefinition/long.md +--- +# Input + +```md +[^hello]: this is a long long long long long long long long long long long long long paragraph. +[^world]: this is a long long long long long long long long long long long long long paragraph. + this is a long long long long long long long long long long long long long paragraph. + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,5 +1,3 @@ + [^hello]: this is a long long long long long long long long long long long long long paragraph. +- +-[^world]: +- this is a long long long long long long long long long long long long long paragraph. +- this is a long long long long long long long long long long long long long paragraph. ++[^world]: this is a long long long long long long long long long long long long long paragraph. ++ this is a long long long long long long long long long long long long long paragraph. +``` + +# Output + +```md +[^hello]: this is a long long long long long long long long long long long long long paragraph. +[^world]: this is a long long long long long long long long long long long long long paragraph. + this is a long long long long long long long long long long long long long paragraph. +``` + +# Lines exceeding max width of 80 characters +``` + 1: [^hello]: this is a long long long long long long long long long long long long long paragraph. + 2: [^world]: this is a long long long long long long long long long long long long long paragraph. + 3: this is a long long long long long long long long long long long long long paragraph. +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/footnoteDefinition/multiline.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/footnoteDefinition/multiline.md.snap new file mode 100644 index 000000000000..dd353b28d4d3 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/footnoteDefinition/multiline.md.snap @@ -0,0 +1,89 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/footnoteDefinition/multiline.md +--- +# Input + +```md +[^fn1]: + + > ```rs + > fn main() { + > println!("this is some Rust!"); + > } + > ``` + +[^fn2]: Here is a footnote which includes code. + + ```rs + fn main() { + println!("this is some Rust!"); + } + ``` + +[^fn2]: Here is a footnote which includes code. Here is a footnote which includes code. Here is a footnote which includes code. + + ```rs + fn main() { + println!("this is some Rust!"); + } + ``` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,4 +1,5 @@ + [^fn1]: ++ + > ```rs + > fn main() { + > println!("this is some Rust!"); +@@ -13,8 +14,7 @@ + } + ``` + +-[^fn2]: +- Here is a footnote which includes code. Here is a footnote which includes code. Here is a footnote which includes code. ++[^fn2]: Here is a footnote which includes code. Here is a footnote which includes code. Here is a footnote which includes code. + + ```rs + fn main() { +``` + +# Output + +```md +[^fn1]: + + > ```rs + > fn main() { + > println!("this is some Rust!"); + > } + > ``` + +[^fn2]: Here is a footnote which includes code. + + ```rs + fn main() { + println!("this is some Rust!"); + } + ``` + +[^fn2]: Here is a footnote which includes code. Here is a footnote which includes code. Here is a footnote which includes code. + + ```rs + fn main() { + println!("this is some Rust!"); + } + ``` +``` + +# Lines exceeding max width of 80 characters +``` + 17: [^fn2]: Here is a footnote which includes code. Here is a footnote which includes code. Here is a footnote which includes code. +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/footnoteDefinition/sibling.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/footnoteDefinition/sibling.md.snap new file mode 100644 index 000000000000..e992c27ea6bd --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/footnoteDefinition/sibling.md.snap @@ -0,0 +1,114 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/footnoteDefinition/sibling.md +--- +# Input + +```md +[^a]: a +[^a]: a +[^a]: a +[^a]: > 123 +[^a]: a +[^a]: > 123 +[^a]: a +[^a]: a +[^a]: a + +--- + +[^a]: a +[^a]: a +[^a]: a +[^a]: > 123\ + > 456 +[^a]: a +[^a]: > 123\ + > 456 +[^a]: a +[^a]: a +[^a]: a + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,41 +1,23 @@ + [^a]: a +- + [^a]: a +- + [^a]: a +- + [^a]: > 123 +- + [^a]: a +- + [^a]: > 123 +- + [^a]: a +- + [^a]: a +- + [^a]: a + + --- + + [^a]: a +- + [^a]: a +- + [^a]: a +- +-[^a]: +- > 123\ +- > 456 +- ++[^a]: > 123\ ++ > 456 + [^a]: a +- +-[^a]: +- > 123\ +- > 456 +- ++[^a]: > 123\ ++ > 456 + [^a]: a +- + [^a]: a +- + [^a]: a +``` + +# Output + +```md +[^a]: a +[^a]: a +[^a]: a +[^a]: > 123 +[^a]: a +[^a]: > 123 +[^a]: a +[^a]: a +[^a]: a + +--- + +[^a]: a +[^a]: a +[^a]: a +[^a]: > 123\ + > 456 +[^a]: a +[^a]: > 123\ + > 456 +[^a]: a +[^a]: a +[^a]: a +``` 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 new file mode 100644 index 000000000000..3d3609d3ff63 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/front-matter/custom-parser.md.snap @@ -0,0 +1,43 @@ +--- +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 new file mode 100644 index 000000000000..401b4fc608c7 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/front-matter/empty.md.snap @@ -0,0 +1,39 @@ +--- +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/heading/setext.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/heading/setext.md.snap new file mode 100644 index 000000000000..a255e6346ccc --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/heading/setext.md.snap @@ -0,0 +1,40 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/heading/setext.md +--- +# Input + +```md +h1 +=== + +h2 +--- + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,5 @@ +-# h1 ++h1 ++=== + +-## h2 ++h2 ++--- +``` + +# Output + +```md +h1 +=== + +h2 +--- +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/html/multiline-with-trailing-space.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/html/multiline-with-trailing-space.md.snap new file mode 100644 index 000000000000..cf5e0ebfbbc8 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/html/multiline-with-trailing-space.md.snap @@ -0,0 +1,254 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/html/multiline-with-trailing-space.md +--- +# Input + +```md +1. Some test text, the goal is to have the html table below nested within this number. When formating on save Prettier will continue to add an indent each time pushing the table further and further out of sync. + + + + + + + + + + + + + + + + + + + + +
TestTable
willbe
pushedWhen
Format onSave
+ +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,4 +1,4 @@ +-1. Some test text, the goal is to have the html table below nested within this number. When formating on save Prettier will continue to add an indent each time pushing the table further and further out of sync. ++1. Some test text, the goal is to have the html table below nested within this number. When formating on save Prettier will continue to add an indent each time pushing the table further and further out of sync. + + + +``` + +# Output + +```md +1. Some test text, the goal is to have the html table below nested within this number. When formating on save Prettier will continue to add an indent each time pushing the table further and further out of sync. + +
+ + + + + + + + + + + + + + + + + + +
TestTable
willbe
pushedWhen
Format onSave
+``` + +# Errors +``` +multiline-with-trailing-space.md:3:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Parser made no progress while parsing a block. + + 1 │ 1. Some test text, the goal is to have the html table below nested within this number. When formating on save Prettier will continue to add an indent each time pushing the table further and further out of sync.· + 2 │ + > 3 │ + │ ^ + 4 │ + 5 │ + + i stuck token skipped + + 1 │ 1. Some test text, the goal is to have the html table below nested within this number. When formating on save Prettier will continue to add an indent each time pushing the table further and further out of sync.· + 2 │ + > 3 │
Test
+ │ ^ + 4 │ + 5 │ + + i This is likely a parser bug; the token was skipped to recover. + +multiline-with-trailing-space.md:4:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Parser made no progress while parsing a block. + + 3 │
Test
+ > 4 │ + │ ^ + 5 │ + 6 │ + + i stuck token skipped + + 3 │
TestTable
+ > 4 │ + │ ^ + 5 │ + 6 │ + + i This is likely a parser bug; the token was skipped to recover. + +multiline-with-trailing-space.md:5:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Parser made no progress while parsing a block. + + 3 │
TestTable
+ 4 │ + > 5 │ + │ ^ + 6 │ + 7 │ + + i stuck token skipped + + 3 │
TestTable
+ 4 │ + > 5 │ + │ ^ + 6 │ + 7 │ + + i This is likely a parser bug; the token was skipped to recover. + +multiline-with-trailing-space.md:6:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Parser made no progress while parsing a block. + + 4 │ + 5 │ + > 6 │ + │ ^ + 7 │ + 8 │ + + i stuck token skipped + + 4 │ + 5 │ + > 6 │ + │ ^ + 7 │ + 8 │ + + i This is likely a parser bug; the token was skipped to recover. + +multiline-with-trailing-space.md:7:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Parser made no progress while parsing a block. + + 5 │ + 6 │ + > 7 │ + │ ^ + 8 │ + 9 │ + + i stuck token skipped + + 5 │ + 6 │ + > 7 │ + │ ^ + 8 │ + 9 │ + + i This is likely a parser bug; the token was skipped to recover. + +multiline-with-trailing-space.md:8:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Parser made no progress while parsing a block. + + 6 │ + 7 │ + > 8 │ + │ ^ + 9 │ + 10 │ ·· + + i stuck token skipped + + 6 │ + 7 │ + > 8 │ + │ ^ + 9 │ + 10 │ ·· + + i This is likely a parser bug; the token was skipped to recover. + +multiline-with-trailing-space.md:21:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Parser made no progress while parsing a block. + + 19 │ ·· + 20 │ + > 21 │ + │ ^ + 22 │
TestTable
TestTable
TestTable
TestTable
TestTable
Table
willTable
willSave
+ 23 │ + + i stuck token skipped + + 19 │ Save·· + 20 │ + > 21 │ + │ ^ + 22 │ + 23 │ + + i This is likely a parser bug; the token was skipped to recover. + +multiline-with-trailing-space.md:22:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Parser made no progress while parsing a block. + + 20 │ + 21 │ + > 22 │ + │ ^ + 23 │ + + i stuck token skipped + + 20 │ + 21 │ + > 22 │ + │ ^ + 23 │ + + i This is likely a parser bug; the token was skipped to recover. + + +``` + +# Lines exceeding max width of 80 characters +``` + 1: 1. Some test text, the goal is to have the html table below nested within this number. When formating on save Prettier will continue to add an indent each time pushing the table further and further out of sync. +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/html/multiline.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/html/multiline.md.snap new file mode 100644 index 000000000000..5c9b06478584 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/html/multiline.md.snap @@ -0,0 +1,254 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/html/multiline.md +--- +# Input + +```md +1. Some test text, the goal is to have the html table below nested within this number. When formating on save Prettier will continue to add an indent each time pushing the table further and further out of sync. + + + + + + + + + + + + + + + + + + + + +
TestTable
willbe
pushedWhen
Format onSave
+ +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,4 +1,4 @@ +-1. Some test text, the goal is to have the html table below nested within this number. When formating on save Prettier will continue to add an indent each time pushing the table further and further out of sync. ++1. Some test text, the goal is to have the html table below nested within this number. When formating on save Prettier will continue to add an indent each time pushing the table further and further out of sync. + + + +``` + +# Output + +```md +1. Some test text, the goal is to have the html table below nested within this number. When formating on save Prettier will continue to add an indent each time pushing the table further and further out of sync. + +
+ + + + + + + + + + + + + + + + + + +
TestTable
willbe
pushedWhen
Format onSave
+``` + +# Errors +``` +multiline.md:3:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Parser made no progress while parsing a block. + + 1 │ 1. Some test text, the goal is to have the html table below nested within this number. When formating on save Prettier will continue to add an indent each time pushing the table further and further out of sync.· + 2 │ + > 3 │ + │ ^ + 4 │ + 5 │ + + i stuck token skipped + + 1 │ 1. Some test text, the goal is to have the html table below nested within this number. When formating on save Prettier will continue to add an indent each time pushing the table further and further out of sync.· + 2 │ + > 3 │
Test
+ │ ^ + 4 │ + 5 │ + + i This is likely a parser bug; the token was skipped to recover. + +multiline.md:4:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Parser made no progress while parsing a block. + + 3 │
Test
+ > 4 │ + │ ^ + 5 │ + 6 │ + + i stuck token skipped + + 3 │
TestTable
+ > 4 │ + │ ^ + 5 │ + 6 │ + + i This is likely a parser bug; the token was skipped to recover. + +multiline.md:5:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Parser made no progress while parsing a block. + + 3 │
TestTable
+ 4 │ + > 5 │ + │ ^ + 6 │ + 7 │ + + i stuck token skipped + + 3 │
TestTable
+ 4 │ + > 5 │ + │ ^ + 6 │ + 7 │ + + i This is likely a parser bug; the token was skipped to recover. + +multiline.md:6:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Parser made no progress while parsing a block. + + 4 │ + 5 │ + > 6 │ + │ ^ + 7 │ + 8 │ + + i stuck token skipped + + 4 │ + 5 │ + > 6 │ + │ ^ + 7 │ + 8 │ + + i This is likely a parser bug; the token was skipped to recover. + +multiline.md:7:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Parser made no progress while parsing a block. + + 5 │ + 6 │ + > 7 │ + │ ^ + 8 │ + 9 │ + + i stuck token skipped + + 5 │ + 6 │ + > 7 │ + │ ^ + 8 │ + 9 │ + + i This is likely a parser bug; the token was skipped to recover. + +multiline.md:8:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Parser made no progress while parsing a block. + + 6 │ + 7 │ + > 8 │ + │ ^ + 9 │ + 10 │ + + i stuck token skipped + + 6 │ + 7 │ + > 8 │ + │ ^ + 9 │ + 10 │ + + i This is likely a parser bug; the token was skipped to recover. + +multiline.md:21:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Parser made no progress while parsing a block. + + 19 │ + 20 │ + > 21 │ + │ ^ + 22 │
TestTable
TestTable
TestTable
TestTable
TestTable
Table
willTable
willSave
+ 23 │ + + i stuck token skipped + + 19 │ Save + 20 │ + > 21 │ + │ ^ + 22 │ + 23 │ + + i This is likely a parser bug; the token was skipped to recover. + +multiline.md:22:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Parser made no progress while parsing a block. + + 20 │ + 21 │ + > 22 │ + │ ^ + 23 │ + + i stuck token skipped + + 20 │ + 21 │ + > 22 │ + │ ^ + 23 │ + + i This is likely a parser bug; the token was skipped to recover. + + +``` + +# Lines exceeding max width of 80 characters +``` + 1: 1. Some test text, the goal is to have the html table below nested within this number. When formating on save Prettier will continue to add an indent each time pushing the table further and further out of sync. +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/ignore/top-level-range.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/ignore/top-level-range.md.snap new file mode 100644 index 000000000000..f11d8af7f6a3 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/ignore/top-level-range.md.snap @@ -0,0 +1,77 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/ignore/top-level-range.md +--- +# Input + +```md + + + +| some | table | +| - | - | +| 1 | a | +| 2 | b | + + + + +> +> +> +> | some | table | +> | - | - | +> | 1 | a | +> | 2 | b | +> +> +> + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -13,9 +13,9 @@ + > + > + > | some | table | +-> | ---- | ----- | +-> | 1 | a | +-> | 2 | b | ++> | - | - | ++> | 1 | a | ++> | 2 | b | + > + > + > +``` + +# Output + +```md + + + +| some | table | +| - | - | +| 1 | a | +| 2 | b | + + + + +> +> +> +> | some | table | +> | - | - | +> | 1 | a | +> | 2 | b | +> +> +> +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/indentation/example.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/indentation/example.md.snap new file mode 100644 index 000000000000..b7b8bf077c16 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/indentation/example.md.snap @@ -0,0 +1,40 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/indentation/example.md +--- +# Input + +```md +- 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 + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,4 +1,4 @@ +-- Top level list item 1 ++- Top level list item 1 + - Top level list item 2 + - Nested List item 1 + - Nested List item 2 +``` + +# Output + +```md +- 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 +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/inlineCode/backtick.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/inlineCode/backtick.md.snap new file mode 100644 index 000000000000..7466f8ff025a --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/inlineCode/backtick.md.snap @@ -0,0 +1,61 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/inlineCode/backtick.md +--- +# Input + +```md +`` `123` `` + +``12`34`` + +`` `12`` + +``34` `` + +`` ```123``` `` + +``` 3 ``22`` `1` ``` + +`` 2 ```123``` `1` `` + +`` CODE` `` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -6,7 +6,7 @@ + + ``34` `` + +-` ```123``` ` ++`` ```123``` `` + + ``` 3 ``22`` `1` ``` + +``` + +# Output + +```md +`` `123` `` + +``12`34`` + +`` `12`` + +``34` `` + +`` ```123``` `` + +``` 3 ``22`` `1` ``` + +`` 2 ```123``` `1` `` + +`` CODE` `` +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/link/encodedLink.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/link/encodedLink.md.snap new file mode 100644 index 000000000000..05933fba4a9c --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/link/encodedLink.md.snap @@ -0,0 +1,69 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/link/encodedLink.md +--- +# Input + +```md +[link](https://www.google.fr/()foo->bar) +[link](https://www.google.fr/foo->bar) +[link](https://www.google.fr/foo-%3Ebar) +[link](https://www.google.fr/foo-bar) +![link](https://www.google.fr/foo->bar) +![link](https://www.google.fr/foo-%3Ebar) +![link](https://www.google.fr/foo-bar +[link]: https://www.google.fr/foo->bar +[link]: https://www.google.fr/foo-%3Ebar +[link]: https://www.google.fr/foo-) ++[link](https://www.google.fr/()foo->bar) + [link](https://www.google.fr/foo->bar) + [link](https://www.google.fr/foo-%3Ebar) + [link](https://www.google.fr/foo-) ++![link](https://www.google.fr/()foo->bar) + ![link](https://www.google.fr/foo->bar) + ![link](https://www.google.fr/foo-%3Ebar) + ![link](https://www.google.fr/foo-bar + [link]: https://www.google.fr/foo-%3Ebar + [link]: https://www.google.fr/foo-bar) +[link](https://www.google.fr/foo->bar) +[link](https://www.google.fr/foo-%3Ebar) +[link](https://www.google.fr/foo-bar) +![link](https://www.google.fr/foo->bar) +![link](https://www.google.fr/foo-%3Ebar) +![link](https://www.google.fr/foo-bar +[link]: https://www.google.fr/foo->bar +[link]: https://www.google.fr/foo-%3Ebar +[link]: https://www.google.fr/foo- + +[a](https://example.com "\"')") +[a](https://example.com '"\')') +[a](https://example.com ("'\))) + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,29 +1,29 @@ + [hello](#world "title") +-[hello](#world "title") +-[hello](#world "title") ++[hello](#world 'title') ++[hello](#world (title)) + +-[a](https://example.com '"') +-[a](https://example.com '"') +-[a](https://example.com '"') ++[a](https://example.com "\"") ++[a](https://example.com '\"') ++[a](https://example.com (\")) + +-[a](https://example.com "'") +-[a](https://example.com "'") +-[a](https://example.com "'") ++[a](https://example.com "\'") ++[a](https://example.com '\'') ++[a](https://example.com (\')) + +-[a](https://example.com "'") +-[a](https://example.com ")") +-[a](https://example.com ")") ++[a](https://example.com "\'") ++[a](https://example.com '\)') ++[a](https://example.com (\))) + +-[a](https://example.com '"') +-[a](https://example.com "'") +-[a](https://example.com ")") ++[a](https://example.com "\\\"") ++[a](https://example.com '\\\'') ++[a](https://example.com (\\\))) + +-[a](https://example.com "'") +-[a](https://example.com '"') +-[a](https://example.com '"') ++[a](https://example.com "\\'") ++[a](https://example.com '\\"') ++[a](https://example.com (\\")) + + + + [a](https://example.com "\"')") +-[a](https://example.com "\"')") +-[a](https://example.com "\"')") ++[a](https://example.com '"\')') ++[a](https://example.com ("'\))) +``` + +# Output + +```md +[hello](#world "title") +[hello](#world 'title') +[hello](#world (title)) + +[a](https://example.com "\"") +[a](https://example.com '\"') +[a](https://example.com (\")) + +[a](https://example.com "\'") +[a](https://example.com '\'') +[a](https://example.com (\')) + +[a](https://example.com "\'") +[a](https://example.com '\)') +[a](https://example.com (\))) + +[a](https://example.com "\\\"") +[a](https://example.com '\\\'') +[a](https://example.com (\\\))) + +[a](https://example.com "\\'") +[a](https://example.com '\\"') +[a](https://example.com (\\")) + + + +[a](https://example.com "\"')") +[a](https://example.com '"\')') +[a](https://example.com ("'\))) +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/linkReference/case-and-space/case-and-space.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/linkReference/case-and-space/case-and-space.md.snap new file mode 100644 index 000000000000..8bfe17819347 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/linkReference/case-and-space/case-and-space.md.snap @@ -0,0 +1,78 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/linkReference/case-and-space/case-and-space.md +--- +# Input + +```md +# `linkReference` + +[ See `AsyncGeneratorFunction` ][ See `AsyncGeneratorFunction` ] + +# `imageReference` + +![ See `AsyncGeneratorFunction` ][ See `AsyncGeneratorFunction` ] + +# `definition` + +[ See `AsyncGeneratorFunction` ]: ./index.html + +# `footnoteReference` + +[^See`AsyncGeneratorFunction`] + +# `footnoteDefinition` + +[^See`AsyncGeneratorFunction`]: ./index.html + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,14 +1,14 @@ + # `linkReference` + +-[ See `AsyncGeneratorFunction` ][ See `AsyncGeneratorFunction` ] ++[ See `AsyncGeneratorFunction` ][ See `AsyncGeneratorFunction` ] + + # `imageReference` + +-![ See `AsyncGeneratorFunction` ][ See `AsyncGeneratorFunction` ] ++![ See `AsyncGeneratorFunction` ][ See `AsyncGeneratorFunction` ] + + # `definition` + +-[ See `AsyncGeneratorFunction` ]: ./index.html ++[ See `AsyncGeneratorFunction` ]: ./index.html + + # `footnoteReference` + +``` + +# Output + +```md +# `linkReference` + +[ See `AsyncGeneratorFunction` ][ See `AsyncGeneratorFunction` ] + +# `imageReference` + +![ See `AsyncGeneratorFunction` ][ See `AsyncGeneratorFunction` ] + +# `definition` + +[ See `AsyncGeneratorFunction` ]: ./index.html + +# `footnoteReference` + +[^See`AsyncGeneratorFunction`] + +# `footnoteDefinition` + +[^See`AsyncGeneratorFunction`]: ./index.html +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/linkReference/case-and-space/issue-7118.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/linkReference/case-and-space/issue-7118.md.snap new file mode 100644 index 000000000000..ffcaca1f6e50 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/linkReference/case-and-space/issue-7118.md.snap @@ -0,0 +1,66 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/linkReference/case-and-space/issue-7118.md +--- +# Input + +```md +- see[Link to Foo][master-LinkToFoo] + +[master-LinkToFoo]: http://foo.com + +Bla bla [PascalCase][] bla. + +[PascalCase]: ./PascalCase.md + +## [Unreleased] +… +[Unreleased]: https://github.com/username/project/compare/v1.0.0...HEAD + +[darktable]: https://www.darktable.org/ +[js;dr]: https://indieweb.org/js;dr +[LinuxFest Northwest]: https://www.linuxfestnorthwest.org/ +[OpenStreetMap]: https://www.openstreetmap.org/about +[SeaGL]: https://seagl.org/ +[uBlock Origin]: https://github.com/gorhill/uBlock + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -7,7 +7,6 @@ + [PascalCase]: ./PascalCase.md + + ## [Unreleased] +- + … + [Unreleased]: https://github.com/username/project/compare/v1.0.0...HEAD + +``` + +# Output + +```md +- see[Link to Foo][master-LinkToFoo] + +[master-LinkToFoo]: http://foo.com + +Bla bla [PascalCase][] bla. + +[PascalCase]: ./PascalCase.md + +## [Unreleased] +… +[Unreleased]: https://github.com/username/project/compare/v1.0.0...HEAD + +[darktable]: https://www.darktable.org/ +[js;dr]: https://indieweb.org/js;dr +[LinuxFest Northwest]: https://www.linuxfestnorthwest.org/ +[OpenStreetMap]: https://www.openstreetmap.org/about +[SeaGL]: https://seagl.org/ +[uBlock Origin]: https://github.com/gorhill/uBlock +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/linkReference/definition.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/linkReference/definition.md.snap new file mode 100644 index 000000000000..eae4838a44e6 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/linkReference/definition.md.snap @@ -0,0 +1,58 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/linkReference/definition.md +--- +# Input + +```md +[just-url]: https://example.com +[url-with-short-title]: https://example.com "title" +[url-with-long-title]: https://example.com "a long, long title. It's really really long. Here have words." +[empty-title]: https://example.com "" + +[long]: https://example.com/a-long-url/another-segment/yet-another-segment/a-really-long-file-name.php.aspx +[long-with-title]: https://example.com/a-long-url/another-segment/yet-another-segment/a-really-long-file-name.php.aspx "look a title!" +[long-with-empty-title]: https://example.com/a-long-url/another-segment/yet-another-segment/a-really-long-file-name.php.aspx "" + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,7 +1,8 @@ + [just-url]: https://example.com + [url-with-short-title]: https://example.com "title" + [url-with-long-title]: https://example.com "a long, long title. It's really really long. Here have words." +-[empty-title]: https://example.com +-[long]: https://example.com/a-long-url/another-segment/yet-another-segment/a-really-long-file-name.php.aspx ++[empty-title]: https://example.com "" ++ ++[long]: https://example.com/a-long-url/another-segment/yet-another-segment/a-really-long-file-name.php.aspx + [long-with-title]: https://example.com/a-long-url/another-segment/yet-another-segment/a-really-long-file-name.php.aspx "look a title!" +-[long-with-empty-title]: https://example.com/a-long-url/another-segment/yet-another-segment/a-really-long-file-name.php.aspx ++[long-with-empty-title]: https://example.com/a-long-url/another-segment/yet-another-segment/a-really-long-file-name.php.aspx "" +``` + +# Output + +```md +[just-url]: https://example.com +[url-with-short-title]: https://example.com "title" +[url-with-long-title]: https://example.com "a long, long title. It's really really long. Here have words." +[empty-title]: https://example.com "" + +[long]: https://example.com/a-long-url/another-segment/yet-another-segment/a-really-long-file-name.php.aspx +[long-with-title]: https://example.com/a-long-url/another-segment/yet-another-segment/a-really-long-file-name.php.aspx "look a title!" +[long-with-empty-title]: https://example.com/a-long-url/another-segment/yet-another-segment/a-really-long-file-name.php.aspx "" +``` + +# Lines exceeding max width of 80 characters +``` + 3: [url-with-long-title]: https://example.com "a long, long title. It's really really long. Here have words." + 6: [long]: https://example.com/a-long-url/another-segment/yet-another-segment/a-really-long-file-name.php.aspx + 7: [long-with-title]: https://example.com/a-long-url/another-segment/yet-another-segment/a-really-long-file-name.php.aspx "look a title!" + 8: [long-with-empty-title]: https://example.com/a-long-url/another-segment/yet-another-segment/a-really-long-file-name.php.aspx "" +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/linkReference/title.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/linkReference/title.md.snap new file mode 100644 index 000000000000..00d9168b733c --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/linkReference/title.md.snap @@ -0,0 +1,161 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/linkReference/title.md +--- +# Input + +```md +[ref]: https://example.com (bar) +[other-ref]: https://example.com (Shakespeare's "Romeo and Juliet" is a famous play) + +[a]: https://example.com "\"" +[a]: https://example.com '\"' +[a]: https://example.com (\") + +[a]: https://example.com "\'" +[a]: https://example.com '\'' +[a]: https://example.com (\') + +[a]: https://example.com "\'" +[a]: https://example.com '\)' +[a]: https://example.com (\)) + +[a]: https://example.com "\\\"" +[a]: https://example.com '\\\'' +[a]: https://example.com (\\\)) + +[a]: https://example.com "\\'" +[a]: https://example.com '\\"' +[a]: https://example.com (\\") + +[a]: https://example.com "\a\a" +[a]: https://example.com '\a\a' +[a]: https://example.com (\a\a) + +[a]: https://example.com "\\a\\a" +[a]: https://example.com '\\a\\a' +[a]: https://example.com (\\a\\a) + +[a]: https://example.com "\\\a\\\a" +[a]: https://example.com '\\\a\\\a' +[a]: https://example.com (\\\a\\\a) + +[a]: https://example.com "\\\\a\\\\a" +[a]: https://example.com '\\\\a\\\\a' +[a]: https://example.com (\\\\a\\\\a) + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,36 +1,38 @@ +-[ref]: https://example.com "bar" ++[ref]: https://example.com (bar) + [other-ref]: https://example.com (Shakespeare's "Romeo and Juliet" is a famous play) + + [a]: https://example.com "\"" + [a]: https://example.com '\"' + [a]: https://example.com (\") + +-[a]: https://example.com "'" +- ++[a]: https://example.com "\'" + [a]: https://example.com '\'' + [a]: https://example.com (\') + +-[a]: https://example.com "'" +-[a]: https://example.com ")" +- ++[a]: https://example.com "\'" ++[a]: https://example.com '\)' + [a]: https://example.com (\)) + + [a]: https://example.com "\\\"" + [a]: https://example.com '\\\'' + [a]: https://example.com (\\\)) + +-[a]: https://example.com "'" +-[a]: https://example.com '"' +-[a]: https://example.com '"' ++[a]: https://example.com "\\'" ++[a]: https://example.com '\\"' ++[a]: https://example.com (\\") ++ ++[a]: https://example.com "\a\a" ++[a]: https://example.com '\a\a' ++[a]: https://example.com (\a\a) ++ + [a]: https://example.com "\\a\\a" +-[a]: https://example.com "\\a\\a" +-[a]: https://example.com "\\a\\a" +-[a]: https://example.com "\\a\\a" +-[a]: https://example.com "\\a\\a" +-[a]: https://example.com "\\a\\a" ++[a]: https://example.com '\\a\\a' ++[a]: https://example.com (\\a\\a) ++ ++[a]: https://example.com "\\\a\\\a" ++[a]: https://example.com '\\\a\\\a' ++[a]: https://example.com (\\\a\\\a) ++ + [a]: https://example.com "\\\\a\\\\a" +-[a]: https://example.com "\\\\a\\\\a" +-[a]: https://example.com "\\\\a\\\\a" +-[a]: https://example.com "\\\\a\\\\a" +-[a]: https://example.com "\\\\a\\\\a" +-[a]: https://example.com "\\\\a\\\\a" ++[a]: https://example.com '\\\\a\\\\a' ++[a]: https://example.com (\\\\a\\\\a) +``` + +# Output + +```md +[ref]: https://example.com (bar) +[other-ref]: https://example.com (Shakespeare's "Romeo and Juliet" is a famous play) + +[a]: https://example.com "\"" +[a]: https://example.com '\"' +[a]: https://example.com (\") + +[a]: https://example.com "\'" +[a]: https://example.com '\'' +[a]: https://example.com (\') + +[a]: https://example.com "\'" +[a]: https://example.com '\)' +[a]: https://example.com (\)) + +[a]: https://example.com "\\\"" +[a]: https://example.com '\\\'' +[a]: https://example.com (\\\)) + +[a]: https://example.com "\\'" +[a]: https://example.com '\\"' +[a]: https://example.com (\\") + +[a]: https://example.com "\a\a" +[a]: https://example.com '\a\a' +[a]: https://example.com (\a\a) + +[a]: https://example.com "\\a\\a" +[a]: https://example.com '\\a\\a' +[a]: https://example.com (\\a\\a) + +[a]: https://example.com "\\\a\\\a" +[a]: https://example.com '\\\a\\\a' +[a]: https://example.com (\\\a\\\a) + +[a]: https://example.com "\\\\a\\\\a" +[a]: https://example.com '\\\\a\\\\a' +[a]: https://example.com (\\\\a\\\\a) +``` + +# Lines exceeding max width of 80 characters +``` + 2: [other-ref]: https://example.com (Shakespeare's "Romeo and Juliet" is a famous play) +``` 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 new file mode 100644 index 000000000000..56df49ec481e --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/liquid/unbalanced-mismatched-braces.md.snap @@ -0,0 +1,35 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/liquid/unbalanced-mismatched-braces.md +--- +# Input + +```md + +Braces {% doesn't match so these words should not be considered as *liquid node* }} + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -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* }} +``` + +# Output + +```md + +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* }} +``` 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 new file mode 100644 index 000000000000..2e0137b3189e --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/liquid/unbalanced-object-close-only.md.snap @@ -0,0 +1,38 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/liquid/unbalanced-object-close-only.md +--- +# Input + +```md + + +Following brace doesn't open so these words should not be considered as *liquid node* }} + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1,3 @@ +-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 + +```md + + +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* }} +``` 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 new file mode 100644 index 000000000000..5c3396c42b48 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/liquid/unbalanced-object-open-only.md.snap @@ -0,0 +1,38 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/liquid/unbalanced-object-open-only.md +--- +# Input + +```md + + +This brace {{ doesn't close so these words should not be considered as *liquid node* + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1,3 @@ +-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 + +```md + + +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* +``` 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 new file mode 100644 index 000000000000..862b65c159c9 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/liquid/unbalanced-template-close-only.md.snap @@ -0,0 +1,38 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/liquid/unbalanced-template-close-only.md +--- +# Input + +```md + + +Following brace doesn't open so these words should not be considered as *liquid node* %} + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1,3 @@ +-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 + +```md + + +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* %} +``` 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 new file mode 100644 index 000000000000..e80f1e26b6db --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/liquid/unbalanced-template-open-only.md.snap @@ -0,0 +1,38 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/liquid/unbalanced-template-open-only.md +--- +# Input + +```md + + +This brace {% doesn't close so these words should not be considered as *liquid node* + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1,3 @@ +-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 + +```md + + +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* +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/align.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/align.md.snap new file mode 100644 index 000000000000..c1a183f24535 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/align.md.snap @@ -0,0 +1,156 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/list/align.md +--- +# Input + +```md +1. 123 + +--- + +11. 123 + +--- + +111. 123 + +--- + +1111. 123 + +--- + +11111. 123 + +--- + +1. 123 + +--- + +1. 123 +2. 123 + +--- + +11. 123 +1. 123 + +--- + +11. 123 +1. 123 + +--- + +1. 123 +2. 123 + 1. 123 + 2. 123 + +--- + +1. 123 +2. 123 + 1. 123 + 2. 123 + +--- + +- 123 +- 123 + 1. 123 + 2. 123 + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -39,15 +39,15 @@ + + 1. 123 + 2. 123 +- 1. 123 +- 2. 123 ++ 1. 123 ++ 2. 123 + + --- + + 1. 123 + 2. 123 +- 1. 123 +- 2. 123 ++ 1. 123 ++ 2. 123 + + --- + +``` + +# Output + +```md +1. 123 + +--- + +11. 123 + +--- + +111. 123 + +--- + +1111. 123 + +--- + +11111. 123 + +--- + +1. 123 + +--- + +1. 123 +2. 123 + +--- + +11. 123 +1. 123 + +--- + +11. 123 +1. 123 + +--- + +1. 123 +2. 123 + 1. 123 + 2. 123 + +--- + +1. 123 +2. 123 + 1. 123 + 2. 123 + +--- + +- 123 +- 123 + 1. 123 + 2. 123 +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/codeblock.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/codeblock.md.snap new file mode 100644 index 000000000000..8cf424dc04e2 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/codeblock.md.snap @@ -0,0 +1,144 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/list/codeblock.md +--- +# Input + +```md +1. ol01 + + ```js + const a = 1; + + + const b = 2; + ``` + +2. ol02 + + ```js + const a = 1; + + + const b = 2; + ``` + +- ul01 + + ```js + const a = 1; + + + const b = 2; + ``` + +- ul02 + + ```js + const a = 1; + + + const b = 2; + ``` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,35 +1,35 @@ + 1. ol01 + +- ```js +- const a = 1; ++ ```js ++ const a = 1; + + +- const b = 2; +- ``` ++ const b = 2; ++ ``` + + 2. ol02 + +- ```js +- const a = 1; ++ ```js ++ const a = 1; + + +- const b = 2; +- ``` ++ const b = 2; ++ ``` + + - ul01 + +- ```js +- const a = 1; ++ ```js ++ const a = 1; + + +- const b = 2; +- ``` ++ const b = 2; ++ ``` + + - ul02 + +- ```js +- const a = 1; ++ ```js ++ const a = 1; + + +- const b = 2; +- ``` ++ const b = 2; ++ ``` +``` + +# Output + +```md +1. ol01 + + ```js + const a = 1; + + + const b = 2; + ``` + +2. ol02 + + ```js + const a = 1; + + + const b = 2; + ``` + +- ul01 + + ```js + const a = 1; + + + const b = 2; + ``` + +- ul02 + + ```js + const a = 1; + + + const b = 2; + ``` +``` 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 new file mode 100644 index 000000000000..395e1b224fa7 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/combined-lists.md.snap @@ -0,0 +1,67 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/list/combined-lists.md +--- +# Input + +```md +* hello1 + +* hello2 + + +* hello3 + +* hello4 + + +* hello5 + +* hello6 +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,11 +1,13 @@ +-- hello1 ++* hello1 + +-- hello2 ++* hello2 ++ ++ ++* hello3 + +-- hello3 ++* hello4 + +-- hello4 + +-- hello5 ++* hello5 + +-- hello6 ++* hello6 +\ No newline at end of file +``` + +# Output + +```md +* hello1 + +* hello2 + + +* hello3 + +* hello4 + + +* hello5 + +* hello6``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/git-diff-friendly.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/git-diff-friendly.md.snap new file mode 100644 index 000000000000..fe933b4687ea --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/git-diff-friendly.md.snap @@ -0,0 +1,33 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/list/git-diff-friendly.md +--- +# Input + +```md +5. abc +1. def +999. ghi + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ + 5. abc + 1. def +-1. ghi ++999. ghi +``` + +# Output + +```md +5. abc +1. def +999. ghi +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/indent.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/indent.md.snap new file mode 100644 index 000000000000..7c9c3801788f --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/indent.md.snap @@ -0,0 +1,348 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/list/indent.md +--- +# Input + +```md +- [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + - a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + + - [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + + 1. a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + + 1. [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + + 12345678) a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + + 12345678. [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + + a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + +1. [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + - a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + + - [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + + 1. a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + + 1. [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + + 12345678) a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + + 12345678. [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + + a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + +12345678) [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + + - a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + + - [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + + 1. a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + + 1. [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + + 12345678) a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + + 12345678. [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + + a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,54 +1,63 @@ + - [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a +- - a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + +- b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b ++ - a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + +- - [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a ++ b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + +- b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b +- 1. a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a ++ - [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + +- b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b ++ b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + +- 1. [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a ++ 1. a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + +- b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b +- 12345678) a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a ++ b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b ++ ++ 1. [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + +- b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b +- 12345678. [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a ++ b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + +- b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b ++ 12345678) a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + +- a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a ++ b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b ++ ++ 12345678. [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a ++ ++ b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b ++ ++ a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + 1. [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a +- - a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + +- b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b ++ - a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + +- - [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a ++ b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + +- b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b +- 1. a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a ++ - [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + +- 1. [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a ++ 1. a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + +- b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b +- 12345678) a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a ++ b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + +- b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b +- 12345678. [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a ++ 1. [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a ++ ++ b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b ++ ++ 12345678) a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + +- b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b ++ b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + +- a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a ++ 12345678. [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + ++ b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b ++ ++ a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a ++ + 12345678) [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b ++ + - a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b +@@ -56,6 +65,7 @@ + - [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b ++ + 1. a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b +@@ -63,9 +73,11 @@ + 1. [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b ++ + 12345678) a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b ++ + 12345678. [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b +``` + +# Output + +```md +- [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + - a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + + - [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + + 1. a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + + 1. [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + + 12345678) a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + + 12345678. [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + + a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + +1. [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + - a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + + - [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + + 1. a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + + 1. [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + + 12345678) a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + + 12345678. [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + + a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + +12345678) [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + + - a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + + - [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + + 1. a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + + 1. [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + + 12345678) a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + + 12345678. [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + + b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + + a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a +``` + +# Lines exceeding max width of 80 characters +``` + 1: - [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + 3: - a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + 5: b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + 7: - [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + 9: b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + 11: 1. a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + 13: b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + 15: 1. [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + 17: b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + 19: 12345678) a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + 21: b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + 23: 12345678. [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + 25: b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + 27: a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + 29: 1. [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + 31: - a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + 33: b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + 35: - [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + 37: b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + 39: 1. a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + 41: b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + 43: 1. [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + 45: b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + 47: 12345678) a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + 49: b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + 51: 12345678. [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + 53: b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + 55: a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + 57: 12345678) [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + 59: b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + 61: - a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + 63: b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + 65: - [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + 67: b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + 69: 1. a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + 71: b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + 73: 1. [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + 75: b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + 77: 12345678) a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + 79: b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + 81: 12345678. [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + 83: b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + 85: a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a +``` 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 new file mode 100644 index 000000000000..6d71fbebfbcf --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/interrupt.md.snap @@ -0,0 +1,31 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/list/interrupt.md +--- +# Input + +```md +* Something +### Some heading + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,2 @@ +-- Something +- ++* Something + ### Some heading +``` + +# Output + +```md +* Something +### Some heading +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/issue-17652.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/issue-17652.md.snap new file mode 100644 index 000000000000..a71a23616686 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/issue-17652.md.snap @@ -0,0 +1,98 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/list/issue-17652.md +--- +# Input + +```md +1. Some text, and code block below, with newline after code block + + ```yaml + --- + foo: bar + ``` + + 1. Another + 2. List + +1. Some text, and code block below, with newline after code block + + 1. Another + 2. List + + + ```yaml + --- + foo: bar + ``` + + 1. Another + 2. List + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -9,9 +9,11 @@ + 2. List + + 1. Some text, and code block below, with newline after code block ++ + 1. Another + 2. List + ++ + ```yaml + --- + foo: bar +``` + +# Output + +```md +1. Some text, and code block below, with newline after code block + + ```yaml + --- + foo: bar + ``` + + 1. Another + 2. List + +1. Some text, and code block below, with newline after code block + + 1. Another + 2. List + + + ```yaml + --- + foo: bar + ``` + + 1. Another + 2. List +``` + +# Errors +``` +issue-17652.md:11:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected an ordered list item + + 9 │ 2. List + 10 │ + > 11 │ 1. Some text, and code block below, with newline after code block + │ ^^ + 12 │ + 13 │ 1. Another + + i Ordered list items start with a number followed by `.` or `)` at the beginning of a line + + +``` 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 new file mode 100644 index 000000000000..01364001b4a4 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/issue-7846.md.snap @@ -0,0 +1,60 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/list/issue-7846.md +--- +# Input + +```md +- a a + b b + c c + d d + e e + +1. a a a + b b b + c c c + d d d + e e e +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,11 +1,11 @@ + - a a + b b +- c c ++ c c + d d + e e + + 1. a a a +- b b b +- c c c +- d d d +- e e e ++ b b b ++ c c c ++ d d d ++ e e e +\ No newline at end of file +``` + +# Output + +```md +- a a + b b + c c + d d + e e + +1. a a a + b b b + c c c + d d d + e e e``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/loose.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/loose.md.snap new file mode 100644 index 000000000000..609ed629c9a2 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/loose.md.snap @@ -0,0 +1,56 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/list/loose.md +--- +# Input + +```md +- 123 + + - abc + +- 456 + + - def + +- 789 + + - ghi + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,8 +1,11 @@ + - 123 ++ + - abc + + - 456 ++ + - def + + - 789 ++ + - ghi +``` + +# Output + +```md +- 123 + + - abc + +- 456 + + - def + +- 789 + + - ghi +``` 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 new file mode 100644 index 000000000000..187ec9c99ec1 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/nested-checkbox.md.snap @@ -0,0 +1,72 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/list/nested-checkbox.md +--- +# Input + +```md +* 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 + +* [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 + + paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,9 +1,11 @@ +-- 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 + +-- [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 ++ 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 + + * 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] 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 + 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 + 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 new file mode 100644 index 000000000000..fd17f4cd36ad --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/nested-tab.md.snap @@ -0,0 +1,80 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/list/nested-tab.md +--- +# Input + +```md +# List with 1 tab indentation and `-` +- 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 + +# List with 1 tab indentation and `*` +* 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 + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,17 +1,15 @@ + # List with 1 tab indentation and `-` +- + - 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 ++ - Nested List item 1 ++ - Nested List item 2 ++ - Sub-Nested List item 1 ++ - Sub-Nested List item 2 + + # List with 1 tab indentation and `*` +- +-- 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 ++ * Sub-Nested List item 2 +``` + +# Output + +```md +# List with 1 tab indentation and `-` +- 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 + +# List with 1 tab indentation and `*` +* 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 +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/start.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/start.md.snap new file mode 100644 index 000000000000..8f854455da5d --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/start.md.snap @@ -0,0 +1,265 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/list/start.md +--- +# Input + +```md +5. abc +6. def +7. ghi + +--- + +0. abc +0. def +0. ghi + +--- + +1. abc +1. def +1. ghi + +--- + +2. abc +2. def +2. ghi + +--- + +0. abc +1. def +2. ghi + +--- + +0. abc +1. def +1. ghi + +--- + +1. abc +2. def +3. ghi + +--- + +2. abc +3. def +4. ghi + +--- + +999. abc +145. def +69. ghi + +--- + +0. abc + +--- + +1. abc + +--- + +2. abc + +--- + +999. abc + +--- + +0. abc +1. def + +--- + +1. abc +2. def + +--- + + +1. abc +1. def + +--- + +2. abc +3. def + +--- + +999. abc +1. def + +--- + +999. abc +2. def + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -5,8 +5,8 @@ + --- + + 0. abc +-1. def +-2. ghi ++0. def ++0. ghi + + --- + +@@ -17,8 +17,8 @@ + --- + + 2. abc +-3. def +-4. ghi ++2. def ++2. ghi + + --- + +@@ -47,8 +47,8 @@ + --- + + 999. abc +-1000. def +-1001. ghi ++145. def ++69. ghi + + --- + +@@ -78,6 +78,7 @@ + + --- + ++ + 1. abc + 1. def + +@@ -94,4 +95,4 @@ + --- + + 999. abc +-1000. def ++2. def +``` + +# Output + +```md +5. abc +6. def +7. ghi + +--- + +0. abc +0. def +0. ghi + +--- + +1. abc +1. def +1. ghi + +--- + +2. abc +2. def +2. ghi + +--- + +0. abc +1. def +2. ghi + +--- + +0. abc +1. def +1. ghi + +--- + +1. abc +2. def +3. ghi + +--- + +2. abc +3. def +4. ghi + +--- + +999. abc +145. def +69. ghi + +--- + +0. abc + +--- + +1. abc + +--- + +2. abc + +--- + +999. abc + +--- + +0. abc +1. def + +--- + +1. abc +2. def + +--- + + +1. abc +1. def + +--- + +2. abc +3. def + +--- + +999. abc +1. def + +--- + +999. abc +2. def +``` 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 new file mode 100644 index 000000000000..6b4d4ad1480c --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/tab.md.snap @@ -0,0 +1,106 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/list/tab.md +--- +# Input + +```md +* Text + + [title](link) + +* Text + + - foo + - foo + - bar + +* Text + + # foo + +* Text + + ``` + foo + ``` + +* Text + + `foo` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,22 +1,23 @@ +-- Text ++* Text + +- [title](link) ++ [title](link) + +-- Text +- - foo +- - foo +- - bar ++* Text + +-- Text ++ - foo ++ - foo ++ - bar + +- # foo ++* Text ++ ++ # foo + +-- Text ++* Text + +- ``` +- foo +- ``` ++ ``` ++ foo ++ ``` + +-- Text ++* Text + +- `foo` ++ `foo` +``` + +# Output + +```md +* Text + + [title](link) + +* Text + + - foo + - foo + - bar + +* Text + + # foo + +* Text + + ``` + foo + ``` + +* Text + + `foo` +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/unordered.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/unordered.md.snap new file mode 100644 index 000000000000..85fdb1a88f74 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/list/unordered.md.snap @@ -0,0 +1,41 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/list/unordered.md +--- +# Input + +```md +- first line + - second line indented +- third line + - fourth line + - fifth line + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,5 +1,5 @@ + - first line +- - second line indented ++ - second line indented + - third line +- - fourth line +- - fifth line ++ - fourth line ++ - fifth line +``` + +# Output + +```md +- first line + - second line indented +- third line + - fourth line + - fifth line +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/long-table/long-table.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/long-table/long-table.md.snap new file mode 100644 index 000000000000..317981ce5b5f --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/long-table/long-table.md.snap @@ -0,0 +1,83 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/long-table/long-table.md +--- +# Input + +```md +| Property | Description | Type | Default | +| -------- | ----------- | ---- | ------- | +| bordered | Toggles rendering of the border around the list | boolean | false | +| footer | List footer renderer | string\|ReactNode | - | +| grid | The grid type of list. You can set grid to something like {gutter: 16, column: 4} | object | - | +| header | List header renderer | string\|ReactNode | - | +| itemLayout | The layout of list, default is `horizontal`, If a vertical list is desired, set the itemLayout property to `vertical` | string | - | +| rowKey | Item's unique key, could be a string or function that returns a string | string\|Function(record):string | `key` | +| loading | Shows a loading indicator while the contents of the list are being fetched | boolean\|[object](https://ant.design/components/spin-cn/#API) ([more](https://github.com/ant-design/ant-design/issues/8659)) | false | +| loadMore | Shows a load more content | string\|ReactNode | - | +| locale | i18n text including empty text | object | emptyText: 'No Data'
| +| pagination | Pagination [config](https://ant.design/components/pagination/), hide it by setting it to false | boolean \| object | false | +| split | Toggles rendering of the split under the list item | boolean | true | +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,13 +1,13 @@ +-| Property | Description | Type | Default | +-| ---------- | --------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ------------------------- | +-| bordered | Toggles rendering of the border around the list | boolean | false | +-| footer | List footer renderer | string\|ReactNode | - | +-| grid | The grid type of list. You can set grid to something like {gutter: 16, column: 4} | object | - | +-| header | List header renderer | string\|ReactNode | - | +-| itemLayout | The layout of list, default is `horizontal`, If a vertical list is desired, set the itemLayout property to `vertical` | string | - | +-| rowKey | Item's unique key, could be a string or function that returns a string | string\|Function(record):string | `key` | +-| loading | Shows a loading indicator while the contents of the list are being fetched | boolean\|[object](https://ant.design/components/spin-cn/#API) ([more](https://github.com/ant-design/ant-design/issues/8659)) | false | +-| loadMore | Shows a load more content | string\|ReactNode | - | +-| locale | i18n text including empty text | object | emptyText: 'No Data'
| +-| pagination | Pagination [config](https://ant.design/components/pagination/), hide it by setting it to false | boolean \| object | false | +-| split | Toggles rendering of the split under the list item | boolean | true | ++| Property | Description | Type | Default | ++| -------- | ----------- | ---- | ------- | ++| bordered | Toggles rendering of the border around the list | boolean | false | ++| footer | List footer renderer | string\|ReactNode | - | ++| grid | The grid type of list. You can set grid to something like {gutter: 16, column: 4} | object | - | ++| header | List header renderer | string\|ReactNode | - | ++| itemLayout | The layout of list, default is `horizontal`, If a vertical list is desired, set the itemLayout property to `vertical` | string | - | ++| rowKey | Item's unique key, could be a string or function that returns a string | string\|Function(record):string | `key` | ++| loading | Shows a loading indicator while the contents of the list are being fetched | boolean\|[object](https://ant.design/components/spin-cn/#API) ([more](https://github.com/ant-design/ant-design/issues/8659)) | false | ++| loadMore | Shows a load more content | string\|ReactNode | - | ++| locale | i18n text including empty text | object | emptyText: 'No Data'
| ++| pagination | Pagination [config](https://ant.design/components/pagination/), hide it by setting it to false | boolean \| object | false | ++| split | Toggles rendering of the split under the list item | boolean | true | +\ No newline at end of file +``` + +# Output + +```md +| Property | Description | Type | Default | +| -------- | ----------- | ---- | ------- | +| bordered | Toggles rendering of the border around the list | boolean | false | +| footer | List footer renderer | string\|ReactNode | - | +| grid | The grid type of list. You can set grid to something like {gutter: 16, column: 4} | object | - | +| header | List header renderer | string\|ReactNode | - | +| itemLayout | The layout of list, default is `horizontal`, If a vertical list is desired, set the itemLayout property to `vertical` | string | - | +| rowKey | Item's unique key, could be a string or function that returns a string | string\|Function(record):string | `key` | +| loading | Shows a loading indicator while the contents of the list are being fetched | boolean\|[object](https://ant.design/components/spin-cn/#API) ([more](https://github.com/ant-design/ant-design/issues/8659)) | false | +| loadMore | Shows a load more content | string\|ReactNode | - | +| locale | i18n text including empty text | object | emptyText: 'No Data'
| +| pagination | Pagination [config](https://ant.design/components/pagination/), hide it by setting it to false | boolean \| object | false | +| split | Toggles rendering of the split under the list item | boolean | true |``` + +# Lines exceeding max width of 80 characters +``` + 5: | grid | The grid type of list. You can set grid to something like {gutter: 16, column: 4} | object | - | + 7: | itemLayout | The layout of list, default is `horizontal`, If a vertical list is desired, set the itemLayout property to `vertical` | string | - | + 8: | rowKey | Item's unique key, could be a string or function that returns a string | string\|Function(record):string | `key` | + 9: | loading | Shows a loading indicator while the contents of the list are being fetched | boolean\|[object](https://ant.design/components/spin-cn/#API) ([more](https://github.com/ant-design/ant-design/issues/8659)) | false | + 12: | pagination | Pagination [config](https://ant.design/components/pagination/), hide it by setting it to false | boolean \| object | false | +``` 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 new file mode 100644 index 000000000000..f617c8ff338b --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/markdown/real-world-case.md.snap @@ -0,0 +1,2497 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/markdown/real-world-case.md +--- +# Input + +```md +# Prettier + +[![Build Status](https://travis-ci.org/prettier/prettier.svg?branch=master)](https://travis-ci.org/prettier/prettier) +[![Codecov](https://img.shields.io/codecov/c/github/prettier/prettier.svg)](https://codecov.io/gh/prettier/prettier) +[![NPM version](https://img.shields.io/npm/v/prettier.svg)](https://www.npmjs.com/package/prettier) +[![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/) + +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)) + +
+Table of Contents + + + + + +* [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? + +Prettier takes your code and reprints it from scratch by taking the line length into account. + +For example, take the following code: + +```js +foo(arg1, arg2, arg3, arg4); +``` + +It fits in a single line so it's going to stay as is. However, we've all run into this situation: + + +```js +foo(reallyLongArg(), omgSoManyParameters(), IShouldRefactorThis(), isThereSeriouslyAnotherOne()); +``` + +Suddenly our previous format for calling function breaks down because this is too long. Prettier is going to do the painstaking work of reprinting it like that for you: + +```js +foo( + reallyLongArg(), + omgSoManyParameters(), + IShouldRefactorThis(), + isThereSeriouslyAnotherOne() +); +``` + +Prettier enforces a consistent code **style** (i.e. code formatting that won't affect the AST) across your entire codebase because it disregards the original styling[\*](#styling-footnote) by parsing it away and re-printing the parsed AST with its own rules that take the maximum line length +into account, wrapping code when necessary. + +\*_Well actually, some +original styling is preserved when practical—see [empty lines] and [multi-line +objects]._ + +[empty lines]:Rationale.md#empty-lines +[multi-line objects]:Rationale.md#multi-line-objects + +If you want to learn more, these two conference talks are great introductions: + + + + +## Why Prettier? + +### Building and enforcing a style guide + +By far the biggest reason for adopting Prettier is to stop all the on-going debates over styles. It is generally accepted that having a common style guide is valuable for a project and team but getting there is a very painful and unrewarding process. People get very emotional around particular ways of writing code and nobody likes spending time writing and receiving nits. +- “We want to free mental threads and end discussions around style. While sometimes fruitful, these discussions are for the most part wasteful.” +- “Literally had an engineer go through a huge effort of cleaning up all of our code because we were debating ternary style for the longest time and were inconsistent about it. It was dumb, but it was a weird on-going "great debate" that wasted lots of little back and forth bits. It's far easier for us all to agree now: just run Prettier, and go with that style.” +- “Getting tired telling people how to style their product code.” +- “Our top reason was to stop wasting our time debating style nits.” +- “Having a githook set up has reduced the amount of style issues in PRs that result in broken builds due to ESLint rules or things I have to nit-pick or clean up later.” +- “I don't want anybody to nitpick any other person ever again.” +- “It reminds me of how Steve Jobs used to wear the same clothes every day because he has a million decisions to make and he didn't want to be bothered to make trivial ones like picking out clothes. I think Prettier is like that.” + +### Helping Newcomers + +Prettier is usually introduced by people with experience in the current codebase and JavaScript but the people that disproportionally benefit from it are newcomers to the codebase. One may think that it's only useful for people with very limited programming experience, but we've seen it quicken the ramp up time from experienced engineers joining the company, as they likely used a different coding style before, and developers coming from a different programming language. +- “My motivations for using Prettier are: appearing that I know how to write JavaScript well.” +- “I always put spaces in the wrong place, now I don't have to worry about it anymore.” +- “When you're a beginner you're making a lot of mistakes caused by the syntax. Thanks to Prettier, you can reduce these mistakes and save a lot of time to focus on what really matters.” +- “As a teacher, I will also tell to my students to install Prettier to help them to learn the JS syntax and have readable files.” + +### Writing code + +What usually happens once people are using Prettier is that they realize that they actually spend a lot of time and mental energy formatting their code. With Prettier editor integration, you can just press that magic key binding and poof, the code is formatted. This is an eye opening experience if anything else. +- “I want to write code. Not spend cycles on formatting.” +- “It removed 5% that sucks in our daily life - aka formatting” +- “We're in 2017 and it's still painful to break a call into multiple lines when you happen to add an argument that makes it go over the 80 columns limit :(“ + +### Easy to adopt + +We've worked very hard to use the least controversial coding styles, went through many rounds of fixing all the edge cases and polished the getting started experience. When you're ready to push Prettier into your codebase, not only should it be painless for you to do it technically but the newly formatted codebase should not generate major controversy and be accepted painlessly by your co-workers. +- “It's low overhead. We were able to throw Prettier at very different kinds of repos without much work.” +- “It's been mostly bug free. Had there been major styling issues during the course of implementation we would have been wary about throwing this at our JS codebase. I'm happy to say that's not the case.” +- “Everyone runs it as part of their pre commit scripts, a couple of us use the editor on save extensions as well.” +- “It's fast, against one of our larger JS codebases we were able to run Prettier in under 13 seconds.” +- “The biggest benefit for Prettier for us was being able to format the entire code base at once.” + +### Clean up an existing codebase + +Since coming up with a coding style and enforcing it is a big undertaking, it often slips through the cracks and you are left working on inconsistent codebases. Running Prettier in this case is a quick win, the codebase is now uniform and easier to read without spending hardly any time. +- “Take a look at the code :) I just need to restore sanity.” +- “We inherited a ~2000 module ES6 code base, developed by 20 different developers over 18 months, in a global team. Felt like such a win without much research.” + +### Ride the hype train + +Purely technical aspects of the projects aren't the only thing people look into when choosing to adopt Prettier. Who built and uses it and how quickly it spreads through the community has a non-trivial impact. +- “The amazing thing, for me, is: 1) Announced 2 months ago. 2) Already adopted by, it seems, every major JS project. 3) 7000 stars, 100,000 npm downloads/mo” +- “Was built by the same people as React & React Native.” +- “I like to be part of the hot new things.” +- “Because soon enough people are gonna ask for it.” + +A few of the [many projects](https://www.npmjs.com/browse/depended/prettier) using Prettier: + + + + + + + + + + + + +

React
React

Jest
Jest

Yarn
Yarn

Babel
Babel

Zeit
Zeit

Webpack-cli
Webpack-cli

+ + +## How does it compare to ESLint (or TSLint, stylelint...)? + +Linters have two categories of rules: + +**Formatting rules**: eg: [max-len](http://eslint.org/docs/rules/max-len), [no-mixed-spaces-and-tabs](http://eslint.org/docs/rules/no-mixed-spaces-and-tabs), [keyword-spacing](http://eslint.org/docs/rules/keyword-spacing), [comma-style](http://eslint.org/docs/rules/comma-style)... + +Prettier alleviates the need for this whole category of rules! Prettier is going to reprint the entire program from scratch in a consistent way, so it's not possible for the programmer to make a mistake there anymore :) + +**Code-quality rules**: eg [no-unused-vars](http://eslint.org/docs/rules/no-unused-vars), [no-extra-bind](http://eslint.org/docs/rules/no-extra-bind), [no-implicit-globals](http://eslint.org/docs/rules/no-implicit-globals), [prefer-promise-reject-errors](http://eslint.org/docs/rules/prefer-promise-reject-errors)... + +Prettier does nothing to help with those kind of rules. They are also the most important ones provided by linters as they are likely to catch real bugs with your code! + + +## Usage + +Install: + +``` +yarn add prettier --dev --exact +``` + +You can install it globally if you like: + +``` +yarn global add prettier +``` + +*We're using `yarn` but you can use `npm` if you like:* + +``` +npm install --save-dev --save-exact prettier +# or globally +npm install --global prettier +``` + +> We recommend pinning an exact version of prettier in your `package.json` +> as we introduce stylistic changes in patch releases. + +### CLI + +Run Prettier through the CLI with this script. Run it without any +arguments to see the [options](#options). + +To format a file in-place, use `--write`. You may want to consider +committing your code before doing that, just in case. + +```bash +prettier [opts] [filename ...] +``` + +In practice, this may look something like: + +```bash +prettier --single-quote --trailing-comma es5 --write "{app,__{tests,mocks}__}/**/*.js" +``` + +Don't forget the quotes around the globs! The quotes make sure that Prettier +expands the globs rather than your shell, for cross-platform usage. +The [glob syntax from the glob module](https://github.com/isaacs/node-glob/blob/master/README.md#glob-primer) +is used. + +#### `--debug-check` + +If you're worried that Prettier will change the correctness of your code, add `--debug-check` to the command. +This will cause Prettier to print an error message if it detects that code correctness might have changed. +Note that `--write` cannot be used with `--debug-check`. + +#### `--find-config-path` and `--config` + +If you are repeatedly formatting individual files with `prettier`, you will incur a small performance cost +when prettier attempts to look up a [configuration file](#configuration-file). In order to skip this, you may +ask prettier to find the config file once, and re-use it later on. + +```bash +prettier --find-config-path ./my/file.js +./my/.prettierrc +``` + +This will provide you with a path to the configuration file, which you can pass to `--config`: + +```bash +prettier --config ./my/.prettierrc --write ./my/file.js +``` + +You can also use `--config` if your configuration file lives somewhere where prettier cannot find it, +such as a `config/` directory. + +If you don't have a configuration file, or want to ignore it if it does exist, +you can pass `--no-config` instead. + +#### `--ignore-path` + +Path to a file containing patterns that describe files to ignore. By default, prettier looks for `./.prettierignore`. + +#### `--require-pragma` + +Require a special comment, called a pragma, to be present in the file's first docblock comment in order for prettier to format it. +```js +/** + * @prettier + */ +``` + +Valid pragmas are `@prettier` and `@format`. + +#### `--list-different` + +Another useful flag is `--list-different` (or `-l`) which prints the filenames of files that are different from Prettier formatting. If there are differences the script errors out, which is useful in a CI scenario. + +```bash +prettier --single-quote --list-different "src/**/*.js" +``` + +#### `--no-config` + +Do not look for a configuration file. The default settings will be used. + +#### `--config-precedence` + +Defines how config file should be evaluated in combination of CLI options. + +**cli-override (default)** + +CLI options take precedence over config file + +**file-override** + +Config file take precedence over CLI options + +**prefer-file** + +If a config file is found will evaluate it and ignore other CLI options. If no config file is found CLI options will evaluate as normal. + +This option adds support to editor integrations where users define their default configuration but want to respect project specific configuration. + +#### `--with-node-modules` + +Prettier CLI will ignore files located in `node_modules` directory. To opt-out from this behavior use `--with-node-modules` flag. + +#### `--write` + +This rewrites all processed files in place. This is comparable to the `eslint --fix` workflow. + +### ESLint + +If you are using ESLint, integrating Prettier to your workflow is straightforward: + +Just add Prettier as an ESLint rule using [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier). + +```js +yarn add --dev prettier eslint-plugin-prettier + +// .eslintrc.json +{ + "plugins": [ + "prettier" + ], + "rules": { + "prettier/prettier": "error" + } +} +``` + +We also recommend that you use [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) to disable all the existing formatting rules. It's a one liner that can be added on-top of any existing ESLint configuration. + +``` +$ yarn add --dev eslint-config-prettier +``` + +.eslintrc.json: + +```json +{ + "extends": [ + "prettier" + ] +} +``` + + +### Pre-commit Hook + +You can use Prettier with a pre-commit tool. This can re-format your files that are marked as "staged" via `git add` before you commit. + +##### Option 1. [lint-staged](https://github.com/okonet/lint-staged) + +Install it along with [husky](https://github.com/typicode/husky): + +```bash +yarn add lint-staged husky --dev +``` + +and add this config to your `package.json`: + +```json +{ + "scripts": { + "precommit": "lint-staged" + }, + "lint-staged": { + "*.{js,json,css}": [ + "prettier --write", + "git add" + ] + } +} +``` +There is a limitation where if you stage specific lines this approach will stage the whole file after regardless. See this [issue](https://github.com/okonet/lint-staged/issues/62) for more info. + +See https://github.com/okonet/lint-staged#configuration for more details about how you can configure lint-staged. + + +##### Option 2. [pre-commit](https://github.com/pre-commit/pre-commit) + +Copy the following config into your `.pre-commit-config.yaml` file: + +```yaml + + - repo: https://github.com/prettier/prettier + sha: '' # Use the sha or tag you want to point at + hooks: + - id: prettier + +``` + +Find more info from [here](https://pre-commit.com). + +##### Option 3. bash script + +Alternately you can save this script as `.git/hooks/pre-commit` and give it execute permission: + +```bash +#!/bin/sh +jsfiles=$(git diff --cached --name-only --diff-filter=ACM | grep '\.jsx\?$' | tr '\n' ' ') +[ -z "$jsfiles" ] && exit 0 + +# Prettify all staged .js files +echo "$jsfiles" | xargs ./node_modules/.bin/prettier --write + +# Add back the modified/prettified files to staging +echo "$jsfiles" | xargs git add + +exit 0 +``` + +### API + +```js +const prettier = require("prettier"); +``` + +#### `prettier.format(source [, options])` + +`format` is used to format text using Prettier. [Options](#options) may be provided to override the defaults. + +```js +prettier.format("foo ( );", { semi: false }); +// -> "foo()" +``` + +#### `prettier.check(source [, options])` + +`check` checks to see if the file has been formatted with Prettier given those options and returns a `Boolean`. +This is similar to the `--list-different` parameter in the CLI and is useful for running Prettier in CI scenarios. + +#### `prettier.formatWithCursor(source [, options])` + +`formatWithCursor` both formats the code, and translates a cursor position from unformatted code to formatted code. +This is useful for editor integrations, to prevent the cursor from moving when code is formatted. + +The `cursorOffset` option should be provided, to specify where the cursor is. + +```js +prettier.formatWithCursor(" 1", { cursorOffset: 2 }); +// -> { formatted: '1;\n', cursorOffset: 1 } +``` + +#### `prettier.resolveConfig([filePath [, options]])` + +`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. + +The promise will be rejected if there was an error parsing the configuration file. + +If `options.useCache` is `false`, all caching will be bypassed. + +```js +const text = fs.readFileSync(filePath, "utf8"); +prettier.resolveConfig(filePath).then(options => { + const formatted = prettier.format(text, options); +}) +``` + +Use `prettier.resolveConfig.sync([filePath [, options]])` if you'd like to use sync version. + +#### `prettier.clearConfigCache()` + +As you repeatedly call `resolveConfig`, the file system structure will be cached for performance. +This function will clear the cache. Generally this is only needed for editor integrations that +know that the file system has changed since the last format took place. + +#### Custom Parser API + +If you need to make modifications to the AST (such as codemods), or you want to provide an alternate parser, you can do so by setting the `parser` option to a function. The function signature of the parser function is: +```js +(text: string, parsers: object, options: object) => AST; +``` + +Prettier's built-in parsers are exposed as properties on the `parsers` argument. + +```js +prettier.format("lodash ( )", { + parser(text, { babylon }) { + const ast = babylon(text); + ast.program.body[0].expression.callee.name = "_"; + return ast; + } +}); +// -> "_();\n" +``` + +The `--parser` CLI option may be a path to a node.js module exporting a parse function. + +### Excluding code from formatting + +A JavaScript comment of `// prettier-ignore` will exclude the next node in the abstract syntax tree from formatting. + +For example: + +```js +matrix( + 1, 0, 0, + 0, 1, 0, + 0, 0, 1 +) + +// prettier-ignore +matrix( + 1, 0, 0, + 0, 1, 0, + 0, 0, 1 +) +``` + +will be transformed to: + +```js +matrix(1, 0, 0, 0, 1, 0, 0, 0, 1); + +// prettier-ignore +matrix( + 1, 0, 0, + 0, 1, 0, + 0, 0, 1 +) +``` + +## Options +Prettier ships with a handful of customizable format options, usable in both the CLI and API. + +### Print Width +Specify the line length that the printer will wrap on. + +> **For readability we recommend against using more than 80 characters:** +> +>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. +> +> 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. + +Default | CLI Override | API Override +--------|--------------|------------- +`80` | `--print-width ` | `printWidth: ` + +### Tab Width +Specify the number of spaces per indentation-level. + +Default | CLI Override | API Override +--------|--------------|------------- + `2` | `--tab-width ` | `tabWidth: ` + +### Tabs +Indent lines with tabs instead of spaces + +Default | CLI Override | API Override +--------|--------------|------------- +`false` | `--use-tabs` | `useTabs: ` + +### Semicolons +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. + +Default | CLI Override | API Override +--------|--------------|------------- +`true` | `--no-semi` | `semi: ` + +### Quotes +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'`. + +Default | CLI Override | API Override +--------|--------------|------------- +`false` | `--single-quote` | `singleQuote: ` + +### Trailing Commas +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/). + +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}`. + +Default | CLI Override | API Override +--------|--------------|------------- +`true` | `--no-bracket-spacing` | `bracketSpacing: ` + +### JSX Brackets +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). + +Default | CLI Override | API Override +--------|--------------|------------- +`false` | `--jsx-bracket-same-line` | `jsxBracketSameLine: ` + +### Range +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. + +Default | CLI Override | API Override +--------|--------------|------------- +`0` | `--range-start `| `rangeStart: ` +`Infinity` | `--range-end ` | `rangeEnd: ` + +### Parser +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_ + +[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")` + +### Filepath +Specify the input filepath. This will be used to do parser inference. + +For example, the following will use `postcss` parser: + +```bash +cat foo | prettier --stdin-filepath foo.css +``` + +Default | CLI Override | API Override +--------|--------------|------------- +None | `--stdin-filepath ` | `filepath: ""` + +### Require pragma +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. + +For example, a file with the following as its first comment will be formatted when `--require-pragma` is supplied: + +```js +/** + * @prettier + */ +``` + +or + +```js +/** + * @format + */ +``` + +Default | CLI Override | API Override +--------|--------------|------------- +`false` | `--require-pragma` | `requirePragma: ` + +## 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. + +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. + +The options to the configuration file are the same the [API options](#options). + +### Basic Configuration + +JSON: + +```json +// .prettierrc +{ + "printWidth": 100, + "parser": "flow" +} +``` + +YAML: + +```yaml +# .prettierrc +printWidth: 100 +parser: flow +``` + +### Configuration Overrides + +Prettier borrows eslint's [override format](http://eslint.org/docs/user-guide/configuring#example-configuration). +This allows you to apply configuration to specific files. + +JSON: + +```json +{ + "semi": false, + "overrides": [{ + "files": "*.test.js", + "options": { + "semi": true + } + }] +} +``` + +YAML: + +```yaml +semi: false +overrides: +- files: "*.test.js" + options: + semi: true +``` + +`files` is required for each override, and may be a string or array of strings. +`excludeFiles` may be optionally provided to exclude files for a given rule, and may also be a string or array of strings. + +To get prettier to format its own `.prettierrc` file, you can do: + +```json +{ + "overrides": [{ + "files": ".prettierrc", + "options": { "parser": "json" } + }] +} +``` + +For more information on how to use the CLI to locate a file, see the [CLI](#cli) section. + +### Configuration Schema + +If you'd like a JSON schema to validate your configuration, one is available here: https://www.schemastore.org/prettierrc. + +## Editor Integration + +### Atom + +Atom users can simply install the [prettier-atom](https://github.com/prettier/prettier-atom) package and use +`Ctrl+Alt+F` to format a file (or format on save if enabled). + +### Emacs + +Emacs users should see [this repository](https://github.com/prettier/prettier-emacs) +for on-demand formatting. + +### Vim + +Vim users can simply install either [sbdchd](https://github.com/sbdchd)/[neoformat](https://github.com/sbdchd/neoformat), [w0rp](https://github.com/w0rp)/[ale](https://github.com/w0rp/ale), or [prettier](https://github.com/prettier)/[vim-prettier](https://github.com/prettier/vim-prettier), for more details see [this directory](https://github.com/prettier/prettier/tree/master/editors/vim). + +### Visual Studio Code + +Can be installed using the extension sidebar. Search for `Prettier - JavaScript formatter`. + +Can also be installed using `ext install prettier-vscode`. + +[Check its repository for configuration and shortcuts](https://github.com/prettier/prettier-vscode) + +### Visual Studio + +Install the [JavaScript Prettier extension](https://github.com/madskristensen/JavaScriptPrettier). + +### Sublime Text + +Sublime Text support is available through Package Control and +the [JsPrettier](https://packagecontrol.io/packages/JsPrettier) plug-in. + +### JetBrains WebStorm, PHPStorm, PyCharm... + +See the [WebStorm +guide](https://github.com/jlongster/prettier/tree/master/editors/webstorm/README.md). + +## Language Support + +Prettier attempts to support all JavaScript language features, +including non-standardized ones. By default it uses the +[Babylon](https://github.com/babel/babylon) parser with all language +features enabled, but you can also use the +[Flow](https://github.com/facebook/flow) parser with 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. + +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/). + +The minimum version of TypeScript supported is 2.1.3 as it introduces the ability to have leading `|` for type definitions which prettier outputs. + +## Related Projects + +- [`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 +- [`prettier-eslint`](https://github.com/prettier/prettier-eslint) +passes `prettier` output to `eslint --fix` +- [`prettier-stylelint`](https://github.com/hugomrdias/prettier-stylelint) +passes `prettier` output to `stylelint --fix` +- [`prettier-standard`](https://github.com/sheerun/prettier-standard) +uses `prettier` and `prettier-eslint` to format code with standard rules +- [`prettier-standard-formatter`](https://github.com/dtinth/prettier-standard-formatter) +passes `prettier` output to `standard --fix` +- [`prettier-miscellaneous`](https://github.com/arijs/prettier-miscellaneous) +`prettier` with a few minor extra options +- [`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 +- [`prettier-github`](https://github.com/jgierer12/prettier-github) formats code in GitHub comments +- [`rollup-plugin-prettier`](https://github.com/mjeanroy/rollup-plugin-prettier) allows you to use Prettier with Rollup +- [`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) +- [`tslint-plugin-prettier`](https://github.com/ikatyang/tslint-plugin-prettier) runs Prettier as a TSLint rule and reports differences as individual TSLint issues +- [`tslint-config-prettier`](https://github.com/alexjoverm/tslint-config-prettier) use TSLint with Prettier without any conflict + +## Technical Details + +This printer is a fork of +[recast](https://github.com/benjamn/recast)'s printer with its +algorithm replaced by the one described by Wadler in "[A prettier +printer](http://homepages.inf.ed.ac.uk/wadler/papers/prettier/prettier.pdf)". +There still may be leftover code from recast that needs to be cleaned +up. + +The basic idea is that the printer takes an AST and returns an +intermediate representation of the output, and the printer uses that +to generate a string. The advantage is that the printer can "measure" +the IR and see if the output is going to fit on a line, and break if +not. + +This means that most of the logic of printing an AST involves +generating an abstract representation of the output involving certain +commands. For example, `concat(["(", line, arg, line ")"])` would +represent a concatenation of opening parens, an argument, and closing +parens. But if that doesn't fit on one line, the printer can break +where `line` is specified. + +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) + +```md +[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier) +``` + +## Contributing + +See [CONTRIBUTING.md](CONTRIBUTING.md). + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -6,14 +6,13 @@ + [![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) + + + + + +---- ++-------------------------------------------------------------------------------- + + ## What does Prettier do? + +@@ -111,19 +110,19 @@ + original styling is preserved when practical—see [empty lines] and [multi-line + objects]._ + +-[empty lines]: Rationale.md#empty-lines +-[multi-line objects]: Rationale.md#multi-line-objects ++[empty lines]:Rationale.md#empty-lines ++[multi-line objects]:Rationale.md#multi-line-objects + + If you want to learn more, these two conference talks are great introductions: + + + ++ + ## Why Prettier? + + ### Building and enforcing a style guide + + By far the biggest reason for adopting Prettier is to stop all the on-going debates over styles. It is generally accepted that having a common style guide is valuable for a project and team but getting there is a very painful and unrewarding process. People get very emotional around particular ways of writing code and nobody likes spending time writing and receiving nits. +- + - “We want to free mental threads and end discussions around style. While sometimes fruitful, these discussions are for the most part wasteful.” + - “Literally had an engineer go through a huge effort of cleaning up all of our code because we were debating ternary style for the longest time and were inconsistent about it. It was dumb, but it was a weird on-going "great debate" that wasted lots of little back and forth bits. It's far easier for us all to agree now: just run Prettier, and go with that style.” + - “Getting tired telling people how to style their product code.” +@@ -135,7 +134,6 @@ + ### Helping Newcomers + + Prettier is usually introduced by people with experience in the current codebase and JavaScript but the people that disproportionally benefit from it are newcomers to the codebase. One may think that it's only useful for people with very limited programming experience, but we've seen it quicken the ramp up time from experienced engineers joining the company, as they likely used a different coding style before, and developers coming from a different programming language. +- + - “My motivations for using Prettier are: appearing that I know how to write JavaScript well.” + - “I always put spaces in the wrong place, now I don't have to worry about it anymore.” + - “When you're a beginner you're making a lot of mistakes caused by the syntax. Thanks to Prettier, you can reduce these mistakes and save a lot of time to focus on what really matters.” +@@ -144,7 +142,6 @@ + ### Writing code + + What usually happens once people are using Prettier is that they realize that they actually spend a lot of time and mental energy formatting their code. With Prettier editor integration, you can just press that magic key binding and poof, the code is formatted. This is an eye opening experience if anything else. +- + - “I want to write code. Not spend cycles on formatting.” + - “It removed 5% that sucks in our daily life - aka formatting” + - “We're in 2017 and it's still painful to break a call into multiple lines when you happen to add an argument that makes it go over the 80 columns limit :(“ +@@ -152,7 +149,6 @@ + ### Easy to adopt + + We've worked very hard to use the least controversial coding styles, went through many rounds of fixing all the edge cases and polished the getting started experience. When you're ready to push Prettier into your codebase, not only should it be painless for you to do it technically but the newly formatted codebase should not generate major controversy and be accepted painlessly by your co-workers. +- + - “It's low overhead. We were able to throw Prettier at very different kinds of repos without much work.” + - “It's been mostly bug free. Had there been major styling issues during the course of implementation we would have been wary about throwing this at our JS codebase. I'm happy to say that's not the case.” + - “Everyone runs it as part of their pre commit scripts, a couple of us use the editor on save extensions as well.” +@@ -162,14 +158,12 @@ + ### Clean up an existing codebase + + Since coming up with a coding style and enforcing it is a big undertaking, it often slips through the cracks and you are left working on inconsistent codebases. Running Prettier in this case is a quick win, the codebase is now uniform and easier to read without spending hardly any time. +- + - “Take a look at the code :) I just need to restore sanity.” + - “We inherited a ~2000 module ES6 code base, developed by 20 different developers over 18 months, in a global team. Felt like such a win without much research.” + + ### Ride the hype train + + Purely technical aspects of the projects aren't the only thing people look into when choosing to adopt Prettier. Who built and uses it and how quickly it spreads through the community has a non-trivial impact. +- + - “The amazing thing, for me, is: 1) Announced 2 months ago. 2) Already adopted by, it seems, every major JS project. 3) 7000 stars, 100,000 npm downloads/mo” + - “Was built by the same people as React & React Native.” + - “I like to be part of the hot new things.” +@@ -190,6 +184,7 @@ + + + ++ + ## How does it compare to ESLint (or TSLint, stylelint...)? + + Linters have two categories of rules: +@@ -202,6 +197,7 @@ + + Prettier does nothing to help with those kind of rules. They are also the most important ones provided by linters as they are likely to catch real bugs with your code! + ++ + ## 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` + +-Path to a file containing patterns that describe files to ignore. By default, prettier looks for `./.prettierignore`. ++Path to a file containing patterns that describe files to ignore. By default, prettier looks for `./.prettierignore`. + + #### `--require-pragma` + + Require a special comment, called a pragma, to be present in the file's first docblock comment in order for prettier to format it. +- + ```js + /** + * @prettier +@@ -305,7 +300,7 @@ + + #### `--no-config` + +-Do not look for a configuration file. The default settings will be used. ++Do not look for a configuration file. The default settings will be used. + + #### `--config-precedence` + +@@ -331,7 +326,7 @@ + + #### `--write` + +-This rewrites all processed files in place. This is comparable to the `eslint --fix` workflow. ++This rewrites all processed files in place. This is comparable to the `eslint --fix` workflow. + + ### ESLint + +@@ -369,6 +364,7 @@ + } + ``` + ++ + ### Pre-commit Hook + + You can use Prettier with a pre-commit tool. This can re-format your files that are marked as "staged" via `git add` before you commit. +@@ -396,11 +392,11 @@ + } + } + ``` +- + There is a limitation where if you stage specific lines this approach will stage the whole file after regardless. See this [issue](https://github.com/okonet/lint-staged/issues/62) for more info. + + See https://github.com/okonet/lint-staged#configuration for more details about how you can configure lint-staged. + ++ + ##### 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 @@ + `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. + +@@ -497,7 +492,6 @@ + #### Custom Parser API + + If you need to make modifications to the AST (such as codemods), or you want to provide an alternate parser, you can do so by setting the `parser` option to a function. The function signature of the parser function is: +- + ```js + (text: string, parsers: object, options: object) => AST; + ``` +@@ -552,138 +546,121 @@ + ``` + + ## Options +- + Prettier ships with a handful of customizable format options, usable in both the CLI and API. + + ### Print Width +- + Specify the line length that the printer will wrap on. + + > **For readability we recommend against using more than 80 characters:** + > +-> 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. ++>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. + > + > 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. + +-| Default | CLI Override | API Override | +-| ------- | --------------------- | ------------------- | +-| `80` | `--print-width ` | `printWidth: ` | ++Default | CLI Override | API Override ++--------|--------------|------------- ++`80` | `--print-width ` | `printWidth: ` + + ### Tab Width +- + Specify the number of spaces per indentation-level. + +-| Default | CLI Override | API Override | +-| ------- | ------------------- | ----------------- | +-| `2` | `--tab-width ` | `tabWidth: ` | ++Default | CLI Override | API Override ++--------|--------------|------------- ++ `2` | `--tab-width ` | `tabWidth: ` + + ### Tabs +- + Indent lines with tabs instead of spaces + +-| Default | CLI Override | API Override | +-| ------- | ------------ | ----------------- | +-| `false` | `--use-tabs` | `useTabs: ` | ++Default | CLI Override | API Override ++--------|--------------|------------- ++`false` | `--use-tabs` | `useTabs: ` + + ### Semicolons +- + 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 | +-| ------- | ------------ | -------------- | +-| `true` | `--no-semi` | `semi: ` | ++Default | CLI Override | API Override ++--------|--------------|------------- ++`true` | `--no-semi` | `semi: ` + + ### Quotes +- + 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 ++--------|--------------|------------- ++`false` | `--single-quote` | `singleQuote: ` + +-| Default | CLI Override | API Override | +-| ------- | ---------------- | --------------------- | +-| `false` | `--single-quote` | `singleQuote: ` | +- + ### Trailing Commas +- + 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 | +-| -------- | ------------------------------------------------------ | ------------------------------------------------------ | +-| `"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}`. + +-| Default | CLI Override | API Override | +-| ------- | ---------------------- | ------------------------ | +-| `true` | `--no-bracket-spacing` | `bracketSpacing: ` | ++Default | CLI Override | API Override ++--------|--------------|------------- ++`true` | `--no-bracket-spacing` | `bracketSpacing: ` + + ### JSX Brackets +- + 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). + +-| Default | CLI Override | API Override | +-| ------- | ------------------------- | ---------------------------- | +-| `false` | `--jsx-bracket-same-line` | `jsxBracketSameLine: ` | ++Default | CLI Override | API Override ++--------|--------------|------------- ++`false` | `--jsx-bracket-same-line` | `jsxBracketSameLine: ` + + ### Range +- + 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 ++--------|--------------|------------- ++`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. + + 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_ + +-[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")` | ++Default | CLI Override | API Override ++--------|--------------|------------- ++`babylon` | `--parser `
`--parser ./my-parser` | `parser: ""`
`parser: require("./my-parser")` + + ### Filepath +- + Specify the input filepath. This will be used to do parser inference. + + For example, the following will use `postcss` parser: +@@ -692,12 +669,11 @@ + cat foo | prettier --stdin-filepath foo.css + ``` + +-| Default | CLI Override | API Override | +-| ------- | --------------------------- | ---------------------- | +-| None | `--stdin-filepath ` | `filepath: ""` | ++Default | CLI Override | API Override ++--------|--------------|------------- ++None | `--stdin-filepath ` | `filepath: ""` + + ### Require pragma +- + 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 @@ + */ + ``` + +-| Default | CLI Override | API Override | +-| ------- | ------------------ | ----------------------- | +-| `false` | `--require-pragma` | `requirePragma: ` | ++Default | CLI Override | API Override ++--------|--------------|------------- ++`false` | `--require-pragma` | `requirePragma: ` + + ## 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 + - [`prettier-eslint`](https://github.com/prettier/prettier-eslint) +- passes `prettier` output to `eslint --fix` ++passes `prettier` output to `eslint --fix` + - [`prettier-stylelint`](https://github.com/hugomrdias/prettier-stylelint) +- passes `prettier` output to `stylelint --fix` ++passes `prettier` output to `stylelint --fix` + - [`prettier-standard`](https://github.com/sheerun/prettier-standard) +- uses `prettier` and `prettier-eslint` to format code with standard rules ++uses `prettier` and `prettier-eslint` to format code with standard rules + - [`prettier-standard-formatter`](https://github.com/dtinth/prettier-standard-formatter) +- passes `prettier` output to `standard --fix` ++passes `prettier` output to `standard --fix` + - [`prettier-miscellaneous`](https://github.com/arijs/prettier-miscellaneous) +- `prettier` with a few minor extra options ++`prettier` with a few minor extra options + - [`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 + +```md +# Prettier + +[![Build Status](https://travis-ci.org/prettier/prettier.svg?branch=master)](https://travis-ci.org/prettier/prettier) +[![Codecov](https://img.shields.io/codecov/c/github/prettier/prettier.svg)](https://codecov.io/gh/prettier/prettier) +[![NPM version](https://img.shields.io/npm/v/prettier.svg)](https://www.npmjs.com/package/prettier) +[![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/) + +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)) + +
+Table of Contents + + + + + +* [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? + +Prettier takes your code and reprints it from scratch by taking the line length into account. + +For example, take the following code: + +```js +foo(arg1, arg2, arg3, arg4); +``` + +It fits in a single line so it's going to stay as is. However, we've all run into this situation: + + +```js +foo(reallyLongArg(), omgSoManyParameters(), IShouldRefactorThis(), isThereSeriouslyAnotherOne()); +``` + +Suddenly our previous format for calling function breaks down because this is too long. Prettier is going to do the painstaking work of reprinting it like that for you: + +```js +foo( + reallyLongArg(), + omgSoManyParameters(), + IShouldRefactorThis(), + isThereSeriouslyAnotherOne() +); +``` + +Prettier enforces a consistent code **style** (i.e. code formatting that won't affect the AST) across your entire codebase because it disregards the original styling[\*](#styling-footnote) by parsing it away and re-printing the parsed AST with its own rules that take the maximum line length +into account, wrapping code when necessary. + +\*_Well actually, some +original styling is preserved when practical—see [empty lines] and [multi-line +objects]._ + +[empty lines]:Rationale.md#empty-lines +[multi-line objects]:Rationale.md#multi-line-objects + +If you want to learn more, these two conference talks are great introductions: + + + + +## Why Prettier? + +### Building and enforcing a style guide + +By far the biggest reason for adopting Prettier is to stop all the on-going debates over styles. It is generally accepted that having a common style guide is valuable for a project and team but getting there is a very painful and unrewarding process. People get very emotional around particular ways of writing code and nobody likes spending time writing and receiving nits. +- “We want to free mental threads and end discussions around style. While sometimes fruitful, these discussions are for the most part wasteful.” +- “Literally had an engineer go through a huge effort of cleaning up all of our code because we were debating ternary style for the longest time and were inconsistent about it. It was dumb, but it was a weird on-going "great debate" that wasted lots of little back and forth bits. It's far easier for us all to agree now: just run Prettier, and go with that style.” +- “Getting tired telling people how to style their product code.” +- “Our top reason was to stop wasting our time debating style nits.” +- “Having a githook set up has reduced the amount of style issues in PRs that result in broken builds due to ESLint rules or things I have to nit-pick or clean up later.” +- “I don't want anybody to nitpick any other person ever again.” +- “It reminds me of how Steve Jobs used to wear the same clothes every day because he has a million decisions to make and he didn't want to be bothered to make trivial ones like picking out clothes. I think Prettier is like that.” + +### Helping Newcomers + +Prettier is usually introduced by people with experience in the current codebase and JavaScript but the people that disproportionally benefit from it are newcomers to the codebase. One may think that it's only useful for people with very limited programming experience, but we've seen it quicken the ramp up time from experienced engineers joining the company, as they likely used a different coding style before, and developers coming from a different programming language. +- “My motivations for using Prettier are: appearing that I know how to write JavaScript well.” +- “I always put spaces in the wrong place, now I don't have to worry about it anymore.” +- “When you're a beginner you're making a lot of mistakes caused by the syntax. Thanks to Prettier, you can reduce these mistakes and save a lot of time to focus on what really matters.” +- “As a teacher, I will also tell to my students to install Prettier to help them to learn the JS syntax and have readable files.” + +### Writing code + +What usually happens once people are using Prettier is that they realize that they actually spend a lot of time and mental energy formatting their code. With Prettier editor integration, you can just press that magic key binding and poof, the code is formatted. This is an eye opening experience if anything else. +- “I want to write code. Not spend cycles on formatting.” +- “It removed 5% that sucks in our daily life - aka formatting” +- “We're in 2017 and it's still painful to break a call into multiple lines when you happen to add an argument that makes it go over the 80 columns limit :(“ + +### Easy to adopt + +We've worked very hard to use the least controversial coding styles, went through many rounds of fixing all the edge cases and polished the getting started experience. When you're ready to push Prettier into your codebase, not only should it be painless for you to do it technically but the newly formatted codebase should not generate major controversy and be accepted painlessly by your co-workers. +- “It's low overhead. We were able to throw Prettier at very different kinds of repos without much work.” +- “It's been mostly bug free. Had there been major styling issues during the course of implementation we would have been wary about throwing this at our JS codebase. I'm happy to say that's not the case.” +- “Everyone runs it as part of their pre commit scripts, a couple of us use the editor on save extensions as well.” +- “It's fast, against one of our larger JS codebases we were able to run Prettier in under 13 seconds.” +- “The biggest benefit for Prettier for us was being able to format the entire code base at once.” + +### Clean up an existing codebase + +Since coming up with a coding style and enforcing it is a big undertaking, it often slips through the cracks and you are left working on inconsistent codebases. Running Prettier in this case is a quick win, the codebase is now uniform and easier to read without spending hardly any time. +- “Take a look at the code :) I just need to restore sanity.” +- “We inherited a ~2000 module ES6 code base, developed by 20 different developers over 18 months, in a global team. Felt like such a win without much research.” + +### Ride the hype train + +Purely technical aspects of the projects aren't the only thing people look into when choosing to adopt Prettier. Who built and uses it and how quickly it spreads through the community has a non-trivial impact. +- “The amazing thing, for me, is: 1) Announced 2 months ago. 2) Already adopted by, it seems, every major JS project. 3) 7000 stars, 100,000 npm downloads/mo” +- “Was built by the same people as React & React Native.” +- “I like to be part of the hot new things.” +- “Because soon enough people are gonna ask for it.” + +A few of the [many projects](https://www.npmjs.com/browse/depended/prettier) using Prettier: + + + + + + + + + + + + +

React
React

Jest
Jest

Yarn
Yarn

Babel
Babel

Zeit
Zeit

Webpack-cli
Webpack-cli

+ + +## How does it compare to ESLint (or TSLint, stylelint...)? + +Linters have two categories of rules: + +**Formatting rules**: eg: [max-len](http://eslint.org/docs/rules/max-len), [no-mixed-spaces-and-tabs](http://eslint.org/docs/rules/no-mixed-spaces-and-tabs), [keyword-spacing](http://eslint.org/docs/rules/keyword-spacing), [comma-style](http://eslint.org/docs/rules/comma-style)... + +Prettier alleviates the need for this whole category of rules! Prettier is going to reprint the entire program from scratch in a consistent way, so it's not possible for the programmer to make a mistake there anymore :) + +**Code-quality rules**: eg [no-unused-vars](http://eslint.org/docs/rules/no-unused-vars), [no-extra-bind](http://eslint.org/docs/rules/no-extra-bind), [no-implicit-globals](http://eslint.org/docs/rules/no-implicit-globals), [prefer-promise-reject-errors](http://eslint.org/docs/rules/prefer-promise-reject-errors)... + +Prettier does nothing to help with those kind of rules. They are also the most important ones provided by linters as they are likely to catch real bugs with your code! + + +## Usage + +Install: + +``` +yarn add prettier --dev --exact +``` + +You can install it globally if you like: + +``` +yarn global add prettier +``` + +*We're using `yarn` but you can use `npm` if you like:* + +``` +npm install --save-dev --save-exact prettier +# or globally +npm install --global prettier +``` + +> We recommend pinning an exact version of prettier in your `package.json` +> as we introduce stylistic changes in patch releases. + +### CLI + +Run Prettier through the CLI with this script. Run it without any +arguments to see the [options](#options). + +To format a file in-place, use `--write`. You may want to consider +committing your code before doing that, just in case. + +```bash +prettier [opts] [filename ...] +``` + +In practice, this may look something like: + +```bash +prettier --single-quote --trailing-comma es5 --write "{app,__{tests,mocks}__}/**/*.js" +``` + +Don't forget the quotes around the globs! The quotes make sure that Prettier +expands the globs rather than your shell, for cross-platform usage. +The [glob syntax from the glob module](https://github.com/isaacs/node-glob/blob/master/README.md#glob-primer) +is used. + +#### `--debug-check` + +If you're worried that Prettier will change the correctness of your code, add `--debug-check` to the command. +This will cause Prettier to print an error message if it detects that code correctness might have changed. +Note that `--write` cannot be used with `--debug-check`. + +#### `--find-config-path` and `--config` + +If you are repeatedly formatting individual files with `prettier`, you will incur a small performance cost +when prettier attempts to look up a [configuration file](#configuration-file). In order to skip this, you may +ask prettier to find the config file once, and re-use it later on. + +```bash +prettier --find-config-path ./my/file.js +./my/.prettierrc +``` + +This will provide you with a path to the configuration file, which you can pass to `--config`: + +```bash +prettier --config ./my/.prettierrc --write ./my/file.js +``` + +You can also use `--config` if your configuration file lives somewhere where prettier cannot find it, +such as a `config/` directory. + +If you don't have a configuration file, or want to ignore it if it does exist, +you can pass `--no-config` instead. + +#### `--ignore-path` + +Path to a file containing patterns that describe files to ignore. By default, prettier looks for `./.prettierignore`. + +#### `--require-pragma` + +Require a special comment, called a pragma, to be present in the file's first docblock comment in order for prettier to format it. +```js +/** + * @prettier + */ +``` + +Valid pragmas are `@prettier` and `@format`. + +#### `--list-different` + +Another useful flag is `--list-different` (or `-l`) which prints the filenames of files that are different from Prettier formatting. If there are differences the script errors out, which is useful in a CI scenario. + +```bash +prettier --single-quote --list-different "src/**/*.js" +``` + +#### `--no-config` + +Do not look for a configuration file. The default settings will be used. + +#### `--config-precedence` + +Defines how config file should be evaluated in combination of CLI options. + +**cli-override (default)** + +CLI options take precedence over config file + +**file-override** + +Config file take precedence over CLI options + +**prefer-file** + +If a config file is found will evaluate it and ignore other CLI options. If no config file is found CLI options will evaluate as normal. + +This option adds support to editor integrations where users define their default configuration but want to respect project specific configuration. + +#### `--with-node-modules` + +Prettier CLI will ignore files located in `node_modules` directory. To opt-out from this behavior use `--with-node-modules` flag. + +#### `--write` + +This rewrites all processed files in place. This is comparable to the `eslint --fix` workflow. + +### ESLint + +If you are using ESLint, integrating Prettier to your workflow is straightforward: + +Just add Prettier as an ESLint rule using [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier). + +```js +yarn add --dev prettier eslint-plugin-prettier + +// .eslintrc.json +{ + "plugins": [ + "prettier" + ], + "rules": { + "prettier/prettier": "error" + } +} +``` + +We also recommend that you use [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) to disable all the existing formatting rules. It's a one liner that can be added on-top of any existing ESLint configuration. + +``` +$ yarn add --dev eslint-config-prettier +``` + +.eslintrc.json: + +```json +{ + "extends": [ + "prettier" + ] +} +``` + + +### Pre-commit Hook + +You can use Prettier with a pre-commit tool. This can re-format your files that are marked as "staged" via `git add` before you commit. + +##### Option 1. [lint-staged](https://github.com/okonet/lint-staged) + +Install it along with [husky](https://github.com/typicode/husky): + +```bash +yarn add lint-staged husky --dev +``` + +and add this config to your `package.json`: + +```json +{ + "scripts": { + "precommit": "lint-staged" + }, + "lint-staged": { + "*.{js,json,css}": [ + "prettier --write", + "git add" + ] + } +} +``` +There is a limitation where if you stage specific lines this approach will stage the whole file after regardless. See this [issue](https://github.com/okonet/lint-staged/issues/62) for more info. + +See https://github.com/okonet/lint-staged#configuration for more details about how you can configure lint-staged. + + +##### Option 2. [pre-commit](https://github.com/pre-commit/pre-commit) + +Copy the following config into your `.pre-commit-config.yaml` file: + +```yaml + + - repo: https://github.com/prettier/prettier + sha: '' # Use the sha or tag you want to point at + hooks: + - id: prettier + +``` + +Find more info from [here](https://pre-commit.com). + +##### Option 3. bash script + +Alternately you can save this script as `.git/hooks/pre-commit` and give it execute permission: + +```bash +#!/bin/sh +jsfiles=$(git diff --cached --name-only --diff-filter=ACM | grep '\.jsx\?$' | tr '\n' ' ') +[ -z "$jsfiles" ] && exit 0 + +# Prettify all staged .js files +echo "$jsfiles" | xargs ./node_modules/.bin/prettier --write + +# Add back the modified/prettified files to staging +echo "$jsfiles" | xargs git add + +exit 0 +``` + +### API + +```js +const prettier = require("prettier"); +``` + +#### `prettier.format(source [, options])` + +`format` is used to format text using Prettier. [Options](#options) may be provided to override the defaults. + +```js +prettier.format("foo ( );", { semi: false }); +// -> "foo()" +``` + +#### `prettier.check(source [, options])` + +`check` checks to see if the file has been formatted with Prettier given those options and returns a `Boolean`. +This is similar to the `--list-different` parameter in the CLI and is useful for running Prettier in CI scenarios. + +#### `prettier.formatWithCursor(source [, options])` + +`formatWithCursor` both formats the code, and translates a cursor position from unformatted code to formatted code. +This is useful for editor integrations, to prevent the cursor from moving when code is formatted. + +The `cursorOffset` option should be provided, to specify where the cursor is. + +```js +prettier.formatWithCursor(" 1", { cursorOffset: 2 }); +// -> { formatted: '1;\n', cursorOffset: 1 } +``` + +#### `prettier.resolveConfig([filePath [, options]])` + +`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. + +The promise will be rejected if there was an error parsing the configuration file. + +If `options.useCache` is `false`, all caching will be bypassed. + +```js +const text = fs.readFileSync(filePath, "utf8"); +prettier.resolveConfig(filePath).then(options => { + const formatted = prettier.format(text, options); +}) +``` + +Use `prettier.resolveConfig.sync([filePath [, options]])` if you'd like to use sync version. + +#### `prettier.clearConfigCache()` + +As you repeatedly call `resolveConfig`, the file system structure will be cached for performance. +This function will clear the cache. Generally this is only needed for editor integrations that +know that the file system has changed since the last format took place. + +#### Custom Parser API + +If you need to make modifications to the AST (such as codemods), or you want to provide an alternate parser, you can do so by setting the `parser` option to a function. The function signature of the parser function is: +```js +(text: string, parsers: object, options: object) => AST; +``` + +Prettier's built-in parsers are exposed as properties on the `parsers` argument. + +```js +prettier.format("lodash ( )", { + parser(text, { babylon }) { + const ast = babylon(text); + ast.program.body[0].expression.callee.name = "_"; + return ast; + } +}); +// -> "_();\n" +``` + +The `--parser` CLI option may be a path to a node.js module exporting a parse function. + +### Excluding code from formatting + +A JavaScript comment of `// prettier-ignore` will exclude the next node in the abstract syntax tree from formatting. + +For example: + +```js +matrix( + 1, 0, 0, + 0, 1, 0, + 0, 0, 1 +) + +// prettier-ignore +matrix( + 1, 0, 0, + 0, 1, 0, + 0, 0, 1 +) +``` + +will be transformed to: + +```js +matrix(1, 0, 0, 0, 1, 0, 0, 0, 1); + +// prettier-ignore +matrix( + 1, 0, 0, + 0, 1, 0, + 0, 0, 1 +) +``` + +## Options +Prettier ships with a handful of customizable format options, usable in both the CLI and API. + +### Print Width +Specify the line length that the printer will wrap on. + +> **For readability we recommend against using more than 80 characters:** +> +>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. +> +> 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. + +Default | CLI Override | API Override +--------|--------------|------------- +`80` | `--print-width ` | `printWidth: ` + +### Tab Width +Specify the number of spaces per indentation-level. + +Default | CLI Override | API Override +--------|--------------|------------- + `2` | `--tab-width ` | `tabWidth: ` + +### Tabs +Indent lines with tabs instead of spaces + +Default | CLI Override | API Override +--------|--------------|------------- +`false` | `--use-tabs` | `useTabs: ` + +### Semicolons +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. + +Default | CLI Override | API Override +--------|--------------|------------- +`true` | `--no-semi` | `semi: ` + +### Quotes +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'`. + +Default | CLI Override | API Override +--------|--------------|------------- +`false` | `--single-quote` | `singleQuote: ` + +### Trailing Commas +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/). + +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}`. + +Default | CLI Override | API Override +--------|--------------|------------- +`true` | `--no-bracket-spacing` | `bracketSpacing: ` + +### JSX Brackets +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). + +Default | CLI Override | API Override +--------|--------------|------------- +`false` | `--jsx-bracket-same-line` | `jsxBracketSameLine: ` + +### Range +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. + +Default | CLI Override | API Override +--------|--------------|------------- +`0` | `--range-start `| `rangeStart: ` +`Infinity` | `--range-end ` | `rangeEnd: ` + +### Parser +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_ + +[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")` + +### Filepath +Specify the input filepath. This will be used to do parser inference. + +For example, the following will use `postcss` parser: + +```bash +cat foo | prettier --stdin-filepath foo.css +``` + +Default | CLI Override | API Override +--------|--------------|------------- +None | `--stdin-filepath ` | `filepath: ""` + +### Require pragma +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. + +For example, a file with the following as its first comment will be formatted when `--require-pragma` is supplied: + +```js +/** + * @prettier + */ +``` + +or + +```js +/** + * @format + */ +``` + +Default | CLI Override | API Override +--------|--------------|------------- +`false` | `--require-pragma` | `requirePragma: ` + +## 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. + +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. + +The options to the configuration file are the same the [API options](#options). + +### Basic Configuration + +JSON: + +```json +// .prettierrc +{ + "printWidth": 100, + "parser": "flow" +} +``` + +YAML: + +```yaml +# .prettierrc +printWidth: 100 +parser: flow +``` + +### Configuration Overrides + +Prettier borrows eslint's [override format](http://eslint.org/docs/user-guide/configuring#example-configuration). +This allows you to apply configuration to specific files. + +JSON: + +```json +{ + "semi": false, + "overrides": [{ + "files": "*.test.js", + "options": { + "semi": true + } + }] +} +``` + +YAML: + +```yaml +semi: false +overrides: +- files: "*.test.js" + options: + semi: true +``` + +`files` is required for each override, and may be a string or array of strings. +`excludeFiles` may be optionally provided to exclude files for a given rule, and may also be a string or array of strings. + +To get prettier to format its own `.prettierrc` file, you can do: + +```json +{ + "overrides": [{ + "files": ".prettierrc", + "options": { "parser": "json" } + }] +} +``` + +For more information on how to use the CLI to locate a file, see the [CLI](#cli) section. + +### Configuration Schema + +If you'd like a JSON schema to validate your configuration, one is available here: https://www.schemastore.org/prettierrc. + +## Editor Integration + +### Atom + +Atom users can simply install the [prettier-atom](https://github.com/prettier/prettier-atom) package and use +`Ctrl+Alt+F` to format a file (or format on save if enabled). + +### Emacs + +Emacs users should see [this repository](https://github.com/prettier/prettier-emacs) +for on-demand formatting. + +### Vim + +Vim users can simply install either [sbdchd](https://github.com/sbdchd)/[neoformat](https://github.com/sbdchd/neoformat), [w0rp](https://github.com/w0rp)/[ale](https://github.com/w0rp/ale), or [prettier](https://github.com/prettier)/[vim-prettier](https://github.com/prettier/vim-prettier), for more details see [this directory](https://github.com/prettier/prettier/tree/master/editors/vim). + +### Visual Studio Code + +Can be installed using the extension sidebar. Search for `Prettier - JavaScript formatter`. + +Can also be installed using `ext install prettier-vscode`. + +[Check its repository for configuration and shortcuts](https://github.com/prettier/prettier-vscode) + +### Visual Studio + +Install the [JavaScript Prettier extension](https://github.com/madskristensen/JavaScriptPrettier). + +### Sublime Text + +Sublime Text support is available through Package Control and +the [JsPrettier](https://packagecontrol.io/packages/JsPrettier) plug-in. + +### JetBrains WebStorm, PHPStorm, PyCharm... + +See the [WebStorm +guide](https://github.com/jlongster/prettier/tree/master/editors/webstorm/README.md). + +## Language Support + +Prettier attempts to support all JavaScript language features, +including non-standardized ones. By default it uses the +[Babylon](https://github.com/babel/babylon) parser with all language +features enabled, but you can also use the +[Flow](https://github.com/facebook/flow) parser with 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. + +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/). + +The minimum version of TypeScript supported is 2.1.3 as it introduces the ability to have leading `|` for type definitions which prettier outputs. + +## Related Projects + +- [`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 +- [`prettier-eslint`](https://github.com/prettier/prettier-eslint) +passes `prettier` output to `eslint --fix` +- [`prettier-stylelint`](https://github.com/hugomrdias/prettier-stylelint) +passes `prettier` output to `stylelint --fix` +- [`prettier-standard`](https://github.com/sheerun/prettier-standard) +uses `prettier` and `prettier-eslint` to format code with standard rules +- [`prettier-standard-formatter`](https://github.com/dtinth/prettier-standard-formatter) +passes `prettier` output to `standard --fix` +- [`prettier-miscellaneous`](https://github.com/arijs/prettier-miscellaneous) +`prettier` with a few minor extra options +- [`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 +- [`prettier-github`](https://github.com/jgierer12/prettier-github) formats code in GitHub comments +- [`rollup-plugin-prettier`](https://github.com/mjeanroy/rollup-plugin-prettier) allows you to use Prettier with Rollup +- [`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) +- [`tslint-plugin-prettier`](https://github.com/ikatyang/tslint-plugin-prettier) runs Prettier as a TSLint rule and reports differences as individual TSLint issues +- [`tslint-config-prettier`](https://github.com/alexjoverm/tslint-config-prettier) use TSLint with Prettier without any conflict + +## Technical Details + +This printer is a fork of +[recast](https://github.com/benjamn/recast)'s printer with its +algorithm replaced by the one described by Wadler in "[A prettier +printer](http://homepages.inf.ed.ac.uk/wadler/papers/prettier/prettier.pdf)". +There still may be leftover code from recast that needs to be cleaned +up. + +The basic idea is that the printer takes an AST and returns an +intermediate representation of the output, and the printer uses that +to generate a string. The advantage is that the printer can "measure" +the IR and see if the output is going to fit on a line, and break if +not. + +This means that most of the logic of printing an AST involves +generating an abstract representation of the output involving certain +commands. For example, `concat(["(", line, arg, line ")"])` would +represent a concatenation of opening parens, an argument, and closing +parens. But if that doesn't fit on one line, the printer can break +where `line` is specified. + +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) + +```md +[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier) +``` + +## Contributing + +See [CONTRIBUTING.md](CONTRIBUTING.md). +``` + +# Lines exceeding max width of 80 characters +``` + 3: [![Build Status](https://travis-ci.org/prettier/prettier.svg?branch=master)](https://travis-ci.org/prettier/prettier) + 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) + 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) + 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()); + 95: Suddenly our previous format for calling function breaks down because this is too long. Prettier is going to do the painstaking work of reprinting it like that for you: + 106: Prettier enforces a consistent code **style** (i.e. code formatting that won't affect the AST) across your entire codebase because it disregards the original styling[\*](#styling-footnote) by parsing it away and re-printing the parsed AST with its own rules that take the maximum line length + 118: + 125: By far the biggest reason for adopting Prettier is to stop all the on-going debates over styles. It is generally accepted that having a common style guide is valuable for a project and team but getting there is a very painful and unrewarding process. People get very emotional around particular ways of writing code and nobody likes spending time writing and receiving nits. + 126: - “We want to free mental threads and end discussions around style. While sometimes fruitful, these discussions are for the most part wasteful.” + 127: - “Literally had an engineer go through a huge effort of cleaning up all of our code because we were debating ternary style for the longest time and were inconsistent about it. It was dumb, but it was a weird on-going "great debate" that wasted lots of little back and forth bits. It's far easier for us all to agree now: just run Prettier, and go with that style.” + 130: - “Having a githook set up has reduced the amount of style issues in PRs that result in broken builds due to ESLint rules or things I have to nit-pick or clean up later.” + 132: - “It reminds me of how Steve Jobs used to wear the same clothes every day because he has a million decisions to make and he didn't want to be bothered to make trivial ones like picking out clothes. I think Prettier is like that.” + 136: Prettier is usually introduced by people with experience in the current codebase and JavaScript but the people that disproportionally benefit from it are newcomers to the codebase. One may think that it's only useful for people with very limited programming experience, but we've seen it quicken the ramp up time from experienced engineers joining the company, as they likely used a different coding style before, and developers coming from a different programming language. + 137: - “My motivations for using Prettier are: appearing that I know how to write JavaScript well.” + 138: - “I always put spaces in the wrong place, now I don't have to worry about it anymore.” + 139: - “When you're a beginner you're making a lot of mistakes caused by the syntax. Thanks to Prettier, you can reduce these mistakes and save a lot of time to focus on what really matters.” + 140: - “As a teacher, I will also tell to my students to install Prettier to help them to learn the JS syntax and have readable files.” + 144: What usually happens once people are using Prettier is that they realize that they actually spend a lot of time and mental energy formatting their code. With Prettier editor integration, you can just press that magic key binding and poof, the code is formatted. This is an eye opening experience if anything else. + 147: - “We're in 2017 and it's still painful to break a call into multiple lines when you happen to add an argument that makes it go over the 80 columns limit :(“ + 151: We've worked very hard to use the least controversial coding styles, went through many rounds of fixing all the edge cases and polished the getting started experience. When you're ready to push Prettier into your codebase, not only should it be painless for you to do it technically but the newly formatted codebase should not generate major controversy and be accepted painlessly by your co-workers. + 152: - “It's low overhead. We were able to throw Prettier at very different kinds of repos without much work.” + 153: - “It's been mostly bug free. Had there been major styling issues during the course of implementation we would have been wary about throwing this at our JS codebase. I'm happy to say that's not the case.” + 154: - “Everyone runs it as part of their pre commit scripts, a couple of us use the editor on save extensions as well.” + 155: - “It's fast, against one of our larger JS codebases we were able to run Prettier in under 13 seconds.” + 156: - “The biggest benefit for Prettier for us was being able to format the entire code base at once.” + 160: Since coming up with a coding style and enforcing it is a big undertaking, it often slips through the cracks and you are left working on inconsistent codebases. Running Prettier in this case is a quick win, the codebase is now uniform and easier to read without spending hardly any time. + 162: - “We inherited a ~2000 module ES6 code base, developed by 20 different developers over 18 months, in a global team. Felt like such a win without much research.” + 166: Purely technical aspects of the projects aren't the only thing people look into when choosing to adopt Prettier. Who built and uses it and how quickly it spreads through the community has a non-trivial impact. + 167: - “The amazing thing, for me, is: 1) Announced 2 months ago. 2) Already adopted by, it seems, every major JS project. 3) 7000 stars, 100,000 npm downloads/mo” + 172: A few of the [many projects](https://www.npmjs.com/browse/depended/prettier) using Prettier: + 176:

React
React

+ 177:

Jest
Jest

+ 178:

Yarn
Yarn

+ 181:

Babel
Babel

+ 182:

Zeit
Zeit

+ 183:

Webpack-cli
Webpack-cli

+ 192: **Formatting rules**: eg: [max-len](http://eslint.org/docs/rules/max-len), [no-mixed-spaces-and-tabs](http://eslint.org/docs/rules/no-mixed-spaces-and-tabs), [keyword-spacing](http://eslint.org/docs/rules/keyword-spacing), [comma-style](http://eslint.org/docs/rules/comma-style)... + 194: Prettier alleviates the need for this whole category of rules! Prettier is going to reprint the entire program from scratch in a consistent way, so it's not possible for the programmer to make a mistake there anymore :) + 196: **Code-quality rules**: eg [no-unused-vars](http://eslint.org/docs/rules/no-unused-vars), [no-extra-bind](http://eslint.org/docs/rules/no-extra-bind), [no-implicit-globals](http://eslint.org/docs/rules/no-implicit-globals), [prefer-promise-reject-errors](http://eslint.org/docs/rules/prefer-promise-reject-errors)... + 198: Prettier does nothing to help with those kind of rules. They are also the most important ones provided by linters as they are likely to catch real bugs with your code! + 241: prettier --single-quote --trailing-comma es5 --write "{app,__{tests,mocks}__}/**/*.js" + 246: The [glob syntax from the glob module](https://github.com/isaacs/node-glob/blob/master/README.md#glob-primer) + 251: If you're worried that Prettier will change the correctness of your code, add `--debug-check` to the command. + 252: This will cause Prettier to print an error message if it detects that code correctness might have changed. + 257: If you are repeatedly formatting individual files with `prettier`, you will incur a small performance cost + 258: when prettier attempts to look up a [configuration file](#configuration-file). In order to skip this, you may + 266: This will provide you with a path to the configuration file, which you can pass to `--config`: + 272: You can also use `--config` if your configuration file lives somewhere where prettier cannot find it, + 280: Path to a file containing patterns that describe files to ignore. By default, prettier looks for `./.prettierignore`. + 284: Require a special comment, called a pragma, to be present in the file's first docblock comment in order for prettier to format it. + 295: Another useful flag is `--list-different` (or `-l`) which prints the filenames of files that are different from Prettier formatting. If there are differences the script errors out, which is useful in a CI scenario. + 319: If a config file is found will evaluate it and ignore other CLI options. If no config file is found CLI options will evaluate as normal. + 321: This option adds support to editor integrations where users define their default configuration but want to respect project specific configuration. + 325: Prettier CLI will ignore files located in `node_modules` directory. To opt-out from this behavior use `--with-node-modules` flag. + 329: This rewrites all processed files in place. This is comparable to the `eslint --fix` workflow. + 333: If you are using ESLint, integrating Prettier to your workflow is straightforward: + 335: Just add Prettier as an ESLint rule using [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier). + 351: We also recommend that you use [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) to disable all the existing formatting rules. It's a one liner that can be added on-top of any existing ESLint configuration. + 370: You can use Prettier with a pre-commit tool. This can re-format your files that are marked as "staged" via `git add` before you commit. + 395: There is a limitation where if you stage specific lines this approach will stage the whole file after regardless. See this [issue](https://github.com/okonet/lint-staged/issues/62) for more info. + 397: See https://github.com/okonet/lint-staged#configuration for more details about how you can configure lint-staged. + 417: Alternately you can save this script as `.git/hooks/pre-commit` and give it execute permission: + 421: jsfiles=$(git diff --cached --name-only --diff-filter=ACM | grep '\.jsx\?$' | tr '\n' ' ') + 441: `format` is used to format text using Prettier. [Options](#options) may be provided to override the defaults. + 450: `check` checks to see if the file has been formatted with Prettier given those options and returns a `Boolean`. + 451: This is similar to the `--list-different` parameter in the CLI and is useful for running Prettier in CI scenarios. + 455: `formatWithCursor` both formats the code, and translates a cursor position from unformatted code to formatted code. + 456: This is useful for editor integrations, to prevent the cursor from moving when code is formatted. + 468: The function optionally accepts an input file path as an argument, which defaults to the current working directory. + 473: The promise will be rejected if there was an error parsing the configuration file. + 484: Use `prettier.resolveConfig.sync([filePath [, options]])` if you'd like to use sync version. + 488: As you repeatedly call `resolveConfig`, the file system structure will be cached for performance. + 489: This function will clear the cache. Generally this is only needed for editor integrations that + 494: If you need to make modifications to the AST (such as codemods), or you want to provide an alternate parser, you can do so by setting the `parser` option to a function. The function signature of the parser function is: + 512: The `--parser` CLI option may be a path to a node.js module exporting a parse function. + 516: A JavaScript comment of `// prettier-ignore` will exclude the next node in the abstract syntax tree from formatting. + 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/). + 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_ + 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`. + 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. + 777: For more information on how to use the CLI to locate a file, see the [CLI](#cli) section. + 781: If you'd like a JSON schema to validate your configuration, one is available here: https://www.schemastore.org/prettierrc. + 787: Atom users can simply install the [prettier-atom](https://github.com/prettier/prettier-atom) package and use + 792: Emacs users should see [this repository](https://github.com/prettier/prettier-emacs) + 797: Vim users can simply install either [sbdchd](https://github.com/sbdchd)/[neoformat](https://github.com/sbdchd/neoformat), [w0rp](https://github.com/w0rp)/[ale](https://github.com/w0rp/ale), or [prettier](https://github.com/prettier)/[vim-prettier](https://github.com/prettier/vim-prettier), for more details see [this directory](https://github.com/prettier/prettier/tree/master/editors/vim). + 801: Can be installed using the extension sidebar. Search for `Prettier - JavaScript formatter`. + 805: [Check its repository for configuration and shortcuts](https://github.com/prettier/prettier-vscode) + 809: Install the [JavaScript Prettier extension](https://github.com/madskristensen/JavaScriptPrettier). + 819: guide](https://github.com/jlongster/prettier/tree/master/editors/webstorm/README.md). + 833: 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/). + 835: The minimum version of TypeScript supported is 2.1.3 as it introduces the ability to have leading `|` for type definitions which prettier outputs. + 839: - [`eslint-plugin-prettier`](https://github.com/prettier/eslint-plugin-prettier) plugs Prettier into your ESLint workflow + 840: - [`eslint-config-prettier`](https://github.com/prettier/eslint-config-prettier) turns off all ESLint rules that are unnecessary or might conflict with Prettier + 847: - [`prettier-standard-formatter`](https://github.com/dtinth/prettier-standard-formatter) + 851: - [`neutrino-preset-prettier`](https://github.com/SpencerCDixon/neutrino-preset-prettier) allows you to use Prettier as a Neutrino preset + 852: - [`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`. + 853: - [`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 + 854: - [`prettier-github`](https://github.com/jgierer12/prettier-github) formats code in GitHub comments + 855: - [`rollup-plugin-prettier`](https://github.com/mjeanroy/rollup-plugin-prettier) allows you to use Prettier with Rollup + 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) + 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 new file mode 100644 index 000000000000..cdbec51053b2 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/markdown/test-case.md.snap @@ -0,0 +1,626 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/markdown/test-case.md +--- +# Input + +```md +[View raw (TEST.md)](https://raw.github.com/adamschwartz/github-markdown-kitchen-sink/master/README.md) + +This is a paragraph. + + This is a paragraph. + + + +Header 1 +======== + +Header 2 +-------- + + Header 1 + ======== + + Header 2 + -------- + + + +# Header 1 +## Header 2 +### Header 3 +#### Header 4 +##### Header 5 +###### Header 6 + + # Header 1 + ## Header 2 + ### Header 3 + #### Header 4 + ##### Header 5 + ###### Header 6 + + + +# Header 1 # +## Header 2 ## +### Header 3 ### +#### Header 4 #### +##### Header 5 ##### +###### Header 6 ###### + + # Header 1 # + ## Header 2 ## + ### Header 3 ### + #### Header 4 #### + ##### Header 5 ##### + ###### Header 6 ###### + + + +> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. + + > Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. + + + +> ## This is a header. +> 1. This is the first list item. +> 2. This is the second list item. +> +> Here's some example code: +> +> Markdown.generate(); + + > ## This is a header. + > 1. This is the first list item. + > 2. This is the second list item. + > + > Here's some example code: + > + > Markdown.generate(); + + + + +- Red +- Green +- Blue + + ++ Red ++ Green ++ Blue + + +* Red +* Green +* Blue + + +```markdown +- Red +- Green +- Blue + ++ Red ++ Green ++ Blue + +* Red +* Green +* Blue +``` + + + +1. Buy flour and salt +1. Mix together with water +1. Bake + +```markdown +1. Buy flour and salt +1. Mix together with water +1. Bake +``` + + + +Paragraph: + + Code + + + + Paragraph: + + Code + + + +* * * + +*** + +***** + +- - - + +--------------------------------------- + + * * * + + *** + + ***** + + - - - + + --------------------------------------- + + + +This is [an example](http://example.com "Example") link. + +[This link](http://example.com) has no title attr. + +These is [an] [example] of two shortcut reference-style links. + +This is [an example][id] reference-style link. + +[id]: http://example.com "Optional Title" + + This is [an example](http://example.com "Example") link. + + [This link](http://example.com) has no title attr. + + These is [an] [example] of two shortcut reference-style links. + + This is [an example][id] reference-style link. + + [id]: http://example.com "Optional Title" + + + +*single asterisks* + +_single underscores_ + +**double asterisks** + +__double underscores__ + + *single asterisks* + + _single underscores_ + + **double asterisks** + + __double underscores__ + + + +This paragraph has some `code` in it. + + This paragraph has some `code` in it. + + + +![Alt Text](http://placehold.it/200x50 "Image Title") + + ![Alt Text](http://placehold.it/200x50 "Image Title") + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -4,26 +4,27 @@ + + This is a paragraph. + +-# Header 1 + +-## Header 2 + ++Header 1 ++======== ++ ++Header 2 ++-------- ++ + Header 1 + ======== + + Header 2 + -------- + +-# Header 1 + +-## Header 2 + ++# Header 1 ++## Header 2 + ### Header 3 +- + #### Header 4 +- + ##### Header 5 +- + ###### Header 6 + + # Header 1 +@@ -33,17 +34,14 @@ + ##### Header 5 + ###### Header 6 + +-# Header 1 + +-## Header 2 + +-### Header 3 +- +-#### Header 4 +- +-##### Header 5 +- +-###### Header 6 ++# Header 1 # ++## Header 2 ## ++### Header 3 ### ++#### Header 4 #### ++##### Header 5 ##### ++###### Header 6 ###### + + # Header 1 # + ## Header 2 ## +@@ -52,12 +50,15 @@ + ##### Header 5 ##### + ###### Header 6 ###### + ++ ++ + > Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. + + > Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. + ++ ++ + > ## This is a header. +-> + > 1. This is the first list item. + > 2. This is the second list item. + > +@@ -73,17 +74,23 @@ + > + > Markdown.generate(); + ++ ++ ++ + - Red + - Green + - Blue + ++ +++ Red +++ Green +++ Blue ++ ++ + * Red + * Green + * Blue + +-- Red +-- Green +-- Blue + + ```markdown + - Red +@@ -99,6 +106,8 @@ + * Blue + ``` + ++ ++ + 1. Buy flour and salt + 1. Mix together with water + 1. Bake +@@ -109,6 +118,8 @@ + 1. Bake + ``` + ++ ++ + Paragraph: + + Code +@@ -119,16 +130,18 @@ + + Code + +---- + +---- + +---- ++* * * + +---- ++*** + +---- ++***** + ++- - - ++ ++--------------------------------------- ++ + * * * + + *** +@@ -139,6 +152,8 @@ + + --------------------------------------- + ++ ++ + This is [an example](http://example.com "Example") link. + + [This link](http://example.com) has no title attr. +@@ -159,13 +174,15 @@ + + [id]: http://example.com "Optional Title" + +-_single asterisks_ + ++ ++*single asterisks* ++ + _single underscores_ + + **double asterisks** + +-**double underscores** ++__double underscores__ + + *single asterisks* + +@@ -175,10 +192,14 @@ + + __double underscores__ + ++ ++ + This paragraph has some `code` in it. + + This paragraph has some `code` in it. + ++ ++ + ![Alt Text](http://placehold.it/200x50 "Image Title") + + ![Alt Text](http://placehold.it/200x50 "Image Title") +``` + +# Output + +```md +[View raw (TEST.md)](https://raw.github.com/adamschwartz/github-markdown-kitchen-sink/master/README.md) + +This is a paragraph. + + This is a paragraph. + + + +Header 1 +======== + +Header 2 +-------- + + Header 1 + ======== + + Header 2 + -------- + + + +# Header 1 +## Header 2 +### Header 3 +#### Header 4 +##### Header 5 +###### Header 6 + + # Header 1 + ## Header 2 + ### Header 3 + #### Header 4 + ##### Header 5 + ###### Header 6 + + + +# Header 1 # +## Header 2 ## +### Header 3 ### +#### Header 4 #### +##### Header 5 ##### +###### Header 6 ###### + + # Header 1 # + ## Header 2 ## + ### Header 3 ### + #### Header 4 #### + ##### Header 5 ##### + ###### Header 6 ###### + + + +> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. + + > Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. + + + +> ## This is a header. +> 1. This is the first list item. +> 2. This is the second list item. +> +> Here's some example code: +> +> Markdown.generate(); + + > ## This is a header. + > 1. This is the first list item. + > 2. This is the second list item. + > + > Here's some example code: + > + > Markdown.generate(); + + + + +- Red +- Green +- Blue + + ++ Red ++ Green ++ Blue + + +* Red +* Green +* Blue + + +```markdown +- Red +- Green +- Blue + ++ Red ++ Green ++ Blue + +* Red +* Green +* Blue +``` + + + +1. Buy flour and salt +1. Mix together with water +1. Bake + +```markdown +1. Buy flour and salt +1. Mix together with water +1. Bake +``` + + + +Paragraph: + + Code + + + + Paragraph: + + Code + + + +* * * + +*** + +***** + +- - - + +--------------------------------------- + + * * * + + *** + + ***** + + - - - + + --------------------------------------- + + + +This is [an example](http://example.com "Example") link. + +[This link](http://example.com) has no title attr. + +These is [an] [example] of two shortcut reference-style links. + +This is [an example][id] reference-style link. + +[id]: http://example.com "Optional Title" + + This is [an example](http://example.com "Example") link. + + [This link](http://example.com) has no title attr. + + These is [an] [example] of two shortcut reference-style links. + + This is [an example][id] reference-style link. + + [id]: http://example.com "Optional Title" + + + +*single asterisks* + +_single underscores_ + +**double asterisks** + +__double underscores__ + + *single asterisks* + + _single underscores_ + + **double asterisks** + + __double underscores__ + + + +This paragraph has some `code` in it. + + This paragraph has some `code` in it. + + + +![Alt Text](http://placehold.it/200x50 "Image Title") + + ![Alt Text](http://placehold.it/200x50 "Image Title") +``` + +# Lines exceeding max width of 80 characters +``` + 1: [View raw (TEST.md)](https://raw.github.com/adamschwartz/github-markdown-kitchen-sink/master/README.md) + 55: > Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. + 57: > Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/math/math-like.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/math/math-like.md.snap new file mode 100644 index 000000000000..f9c3ec13701d --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/math/math-like.md.snap @@ -0,0 +1,33 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/math/math-like.md +--- +# Input + +```md +$10 - $20 + +Paragraph with $14 million. But if more $dollars on the same line... + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ + $10 - $20 + +-Paragraph with $14 million. But if more $dollars on the same line... ++Paragraph with $14 million. But if more $dollars on the same line... +``` + +# Output + +```md +$10 - $20 + +Paragraph with $14 million. But if more $dollars on the same line... +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/math/remark-math.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/math/remark-math.md.snap new file mode 100644 index 000000000000..5aeab6f21021 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/math/remark-math.md.snap @@ -0,0 +1,238 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/math/remark-math.md +--- +# Input + +```md + + +$$ +\beta+\gamma +$$ + +--- + +$\alpha\$ + +--- + +\$\alpha\$ + +--- + +\\$\alpha$ + +--- + +`$`\alpha$ + +--- + +$\alpha`$` foo + +--- + +$`\alpha`$ + +--- + +$\alpha\$$ + +--- + +$$ +\alpha\$ +$$ + +--- + +tango +$$ +\alpha +$$ + +--- + +$$\\alpha$$ + +--- + +$$\alpha$$ +$$ +\alpha\beta +$$ + +--- + +> $$ +> \alpha\beta +> $$ + +--- + + $$$ + \alpha + $$$ + +--- + +$$ must +\alpha +$$ + +--- + +$$ +\alpha +$$ +``` +code fence +``` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -41,7 +41,6 @@ + --- + + tango +- + $$ + \alpha + $$ +@@ -53,7 +52,6 @@ + --- + + $$\alpha$$ +- + $$ + \alpha\beta + $$ +@@ -66,14 +64,13 @@ + + --- + +-$$ +- \alpha +-$$ ++ $$$ ++ \alpha ++ $$$ + + --- + +-$$ +-must ++$$ must + \alpha + $$ + +@@ -82,7 +79,6 @@ + $$ + \alpha + $$ +- + ``` + code fence + ``` +``` + +# Output + +```md + + +$$ +\beta+\gamma +$$ + +--- + +$\alpha\$ + +--- + +\$\alpha\$ + +--- + +\\$\alpha$ + +--- + +`$`\alpha$ + +--- + +$\alpha`$` foo + +--- + +$`\alpha`$ + +--- + +$\alpha\$$ + +--- + +$$ +\alpha\$ +$$ + +--- + +tango +$$ +\alpha +$$ + +--- + +$$\\alpha$$ + +--- + +$$\alpha$$ +$$ +\alpha\beta +$$ + +--- + +> $$ +> \alpha\beta +> $$ + +--- + + $$$ + \alpha + $$$ + +--- + +$$ must +\alpha +$$ + +--- + +$$ +\alpha +$$ +``` +code fence +``` +``` + +# Lines exceeding max width of 80 characters +``` + 1: +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/multiparser-js/jsx-comment.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/multiparser-js/jsx-comment.md.snap new file mode 100644 index 000000000000..4a2f198839de --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/multiparser-js/jsx-comment.md.snap @@ -0,0 +1,55 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/multiparser-js/jsx-comment.md +--- +# Input + +```md +```jsx +const Foo = () => { + return ( +
+ {/* + This links to a page that does not yet exist. + */} +
+
+ ); +}; +``` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -4,7 +4,7 @@ +
+ {/* + This links to a page that does not yet exist. +- */} ++ */} +
+
+ ); +``` + +# Output + +```md +```jsx +const Foo = () => { + return ( +
+ {/* + This links to a page that does not yet exist. + */} +
+
+ ); +}; +``` +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/multiparser-js/meta-in-code-block.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/multiparser-js/meta-in-code-block.md.snap new file mode 100644 index 000000000000..7889641f7d1a --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/multiparser-js/meta-in-code-block.md.snap @@ -0,0 +1,89 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/multiparser-js/meta-in-code-block.md +--- +# Input + +```md +## plain js block + +```js +console.log ( "hello world" ); +``` + +## js block with meta + +```js {cmd=node .line-numbers} +console.log ( "hello world" ); +``` + +## js block with meta but no space (the language should not be detected) + +```js{cmd=node .line-numbers} +console.log ( "hello world" ); +``` + +## js block with meta and extra spaces (only the first set of spaces should be changed) + +```js cmd=node something="a b" +console.log ( "hello world" ); +``` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,6 +1,6 @@ + ## plain js block + +-```js ++```js + console.log ( "hello world" ); + ``` + +@@ -18,6 +18,6 @@ + + ## js block with meta and extra spaces (only the first set of spaces should be changed) + +-```js cmd=node something="a b" ++```js cmd=node something="a b" + console.log ( "hello world" ); + ``` +``` + +# Output + +```md +## plain js block + +```js +console.log ( "hello world" ); +``` + +## js block with meta + +```js {cmd=node .line-numbers} +console.log ( "hello world" ); +``` + +## js block with meta but no space (the language should not be detected) + +```js{cmd=node .line-numbers} +console.log ( "hello world" ); +``` + +## js block with meta and extra spaces (only the first set of spaces should be changed) + +```js cmd=node something="a b" +console.log ( "hello world" ); +``` +``` + +# Lines exceeding max width of 80 characters +``` + 19: ## js block with meta and extra spaces (only the first set of spaces should be changed) +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/multiparser-json/invalid-json.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/multiparser-json/invalid-json.md.snap new file mode 100644 index 000000000000..ba312c06fcc2 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/multiparser-json/invalid-json.md.snap @@ -0,0 +1,36 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/multiparser-json/invalid-json.md +--- +# Input + +```md + +```json +packages\the-hub\cypress\fixtures\gridConfiguration.json +``` +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,5 +1,4 @@ + +- + ```json + packages\the-hub\cypress\fixtures\gridConfiguration.json +-``` ++``` +\ No newline at end of file +``` + +# Output + +```md + +```json +packages\the-hub\cypress\fixtures\gridConfiguration.json +`````` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/paragraph/inline-nodes.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/paragraph/inline-nodes.md.snap new file mode 100644 index 000000000000..8d83778c268f --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/paragraph/inline-nodes.md.snap @@ -0,0 +1,32 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/paragraph/inline-nodes.md +--- +# Input + +```md +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)) + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1 @@ +-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)) ++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)) +``` + +# Output + +```md +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)) +``` + +# Lines exceeding max width of 80 characters +``` + 1: 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)) +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/paragraph/lorem.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/paragraph/lorem.md.snap new file mode 100644 index 000000000000..972299d3ffa3 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/paragraph/lorem.md.snap @@ -0,0 +1,60 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/paragraph/lorem.md +--- +# Input + +```md +Hic dicta et recusandae incidunt. Reiciendis saepe voluptatem tempore rem aut. +Iusto sapiente impedit. Laudantium ut id non et aperiam ab. + +Sit minus architecto quas quibusdam sed ipsam aut eum. +Dolores tempora reiciendis magni blanditiis laborum aliquid rem corporis enim. Et consectetur quo sed excepturi soluta repudiandae commodi id. +Eum possimus optio distinctio incidunt quasi optio culpa accusamus. +Architecto esse ut aut autem ullam consequatur reiciendis aliquid dolorum. + +Et quam mollitia velit iste enim exercitationem nemo. +Hic dignissimos eos et. Eos eos consequatur. + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,10 +1,10 @@ + Hic dicta et recusandae incidunt. Reiciendis saepe voluptatem tempore rem aut. + Iusto sapiente impedit. Laudantium ut id non et aperiam ab. +- ++ + Sit minus architecto quas quibusdam sed ipsam aut eum. + Dolores tempora reiciendis magni blanditiis laborum aliquid rem corporis enim. Et consectetur quo sed excepturi soluta repudiandae commodi id. + Eum possimus optio distinctio incidunt quasi optio culpa accusamus. + Architecto esse ut aut autem ullam consequatur reiciendis aliquid dolorum. +- ++ + Et quam mollitia velit iste enim exercitationem nemo. + Hic dignissimos eos et. Eos eos consequatur. +``` + +# Output + +```md +Hic dicta et recusandae incidunt. Reiciendis saepe voluptatem tempore rem aut. +Iusto sapiente impedit. Laudantium ut id non et aperiam ab. + +Sit minus architecto quas quibusdam sed ipsam aut eum. +Dolores tempora reiciendis magni blanditiis laborum aliquid rem corporis enim. Et consectetur quo sed excepturi soluta repudiandae commodi id. +Eum possimus optio distinctio incidunt quasi optio culpa accusamus. +Architecto esse ut aut autem ullam consequatur reiciendis aliquid dolorum. + +Et quam mollitia velit iste enim exercitationem nemo. +Hic dignissimos eos et. Eos eos consequatur. +``` + +# Lines exceeding max width of 80 characters +``` + 5: Dolores tempora reiciendis magni blanditiis laborum aliquid rem corporis enim. Et consectetur quo sed excepturi soluta repudiandae commodi id. +``` 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 new file mode 100644 index 000000000000..a50eb9ca7fe3 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/paragraph/special-prefix.md.snap @@ -0,0 +1,101 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/paragraph/special-prefix.md +--- +# Input + +```md +abc abc abc 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) - disallow disabled tests. +- [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) - disallow identical titles. +- [valid-expect](/packages/eslint-plugin-jest/docs/rules/valid-expect.md) - ensure expect is called correctly. + +## Supported Rules + +* [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) + - disallow focused tests. +* [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) - + 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? + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,4 +1,4 @@ +-abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc - abc abc abc ++abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc - abc abc abc + + ## 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 + +```md +abc abc abc 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) - disallow disabled tests. +- [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) - disallow identical titles. +- [valid-expect](/packages/eslint-plugin-jest/docs/rules/valid-expect.md) - ensure expect is called correctly. + +## Supported Rules + +* [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) + - disallow focused tests. +* [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) - + 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? +``` + +# Lines exceeding max width of 80 characters +``` + 1: abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc - abc abc abc + 5: - [no-disabled-tests](/packages/eslint-plugin-jest/docs/rules/no-disabled-tests.md) - disallow disabled tests. + 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) + 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/commonmark-0.30-example-329.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/commonmark-0.30-example-329.md.snap new file mode 100644 index 000000000000..9bdedbfb3bf8 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/commonmark-0.30-example-329.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/commonmark-0.30-example-329.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/commonmark-0.30-example-335.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/commonmark-0.30-example-335.md.snap new file mode 100644 index 000000000000..b7d652392986 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/commonmark-0.30-example-335.md.snap @@ -0,0 +1,40 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/commonmark-0.30-example-335.md +--- +# Input + +```md +`` +foo +bar +baz +`` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,5 @@ +-`foo ++`` ++foo + bar +-baz` ++baz ++`` +``` + +# Output + +```md +`` +foo +bar +baz +`` +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/commonmark-0.30-example-336.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/commonmark-0.30-example-336.md.snap new file mode 100644 index 000000000000..a65a5bce7def --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/commonmark-0.30-example-336.md.snap @@ -0,0 +1,33 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/commonmark-0.30-example-336.md +--- +# Input + +```md +`` +foo +`` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1,3 @@ +-`foo ` ++`` ++foo ++`` +``` + +# Output + +```md +`` +foo +`` +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/commonmark-0.30-example-337.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/commonmark-0.30-example-337.md.snap new file mode 100644 index 000000000000..a03a7ba1570f --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/commonmark-0.30-example-337.md.snap @@ -0,0 +1,29 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/commonmark-0.30-example-337.md +--- +# Input + +```md +`foo bar +baz` +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,2 +1,2 @@ + `foo bar +-baz` ++baz` +\ No newline at end of file +``` + +# Output + +```md +`foo bar +baz```` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-1.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-1.md.snap new file mode 100644 index 000000000000..e52e0b826610 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-1.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-1.md +--- +# Input + +```md + foo baz bim + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1 @@ +- foo baz bim ++ foo baz bim +``` + +# Output + +```md + foo baz bim +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-100.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-100.md.snap new file mode 100644 index 000000000000..a1cb7b2421bb --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-100.md.snap @@ -0,0 +1,43 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-100.md +--- +# Input + +```md + ``` + aaa + aaa + aaa + ``` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,5 +1,5 @@ +-``` +-aaa +- aaa +-aaa +-``` ++ ``` ++ aaa ++ aaa ++ aaa ++ ``` +``` + +# Output + +```md + ``` + aaa + aaa + aaa + ``` +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-102.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-102.md.snap new file mode 100644 index 000000000000..86c59477bd87 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-102.md.snap @@ -0,0 +1,33 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-102.md +--- +# Input + +```md +``` +aaa + ``` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ + ``` + aaa +-``` ++ ``` +``` + +# Output + +```md +``` +aaa + ``` +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-103.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-103.md.snap new file mode 100644 index 000000000000..c5cfd43d493a --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-103.md.snap @@ -0,0 +1,34 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-103.md +--- +# Input + +```md + ``` +aaa + ``` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ +-``` ++ ``` + aaa +-``` ++ ``` +``` + +# Output + +```md + ``` +aaa + ``` +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-104.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-104.md.snap new file mode 100644 index 000000000000..1075614d6e6d --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-104.md.snap @@ -0,0 +1,57 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-104.md +--- +# Input + +```md +``` +aaa + ``` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,4 +1,3 @@ +-```` ++``` + aaa + ``` +-```` +``` + +# Output + +```md +``` +aaa + ``` +``` + +# Errors +``` +example-104.md:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Unterminated fenced code block, expected closing triple backticks (```). + + > 1 │ ``` + │ ^^^ + 2 │ aaa + 3 │ ``` + + i code block started here + + > 1 │ ``` + │ ^^^ + 2 │ aaa + 3 │ ``` + + i Add closing triple backticks (```) at the start of a new line. + + +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-105.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-105.md.snap new file mode 100644 index 000000000000..0f144f920afe --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-105.md.snap @@ -0,0 +1,30 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-105.md +--- +# Input + +```md +``` ``` +aaa + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,2 +1,2 @@ +-` ` ++``` ``` + aaa +``` + +# Output + +```md +``` ``` +aaa +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-106.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-106.md.snap new file mode 100644 index 000000000000..5f9d5ec0dd55 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-106.md.snap @@ -0,0 +1,57 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-106.md +--- +# Input + +```md +~~~~~~ +aaa +~~~ ~~ + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,4 +1,3 @@ +-``` ++~~~~~~ + aaa + ~~~ ~~ +-``` +``` + +# Output + +```md +~~~~~~ +aaa +~~~ ~~ +``` + +# Errors +``` +example-106.md:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Unterminated fenced code block, expected closing triple tildes (~~~). + + > 1 │ ~~~~~~ + │ ^^^^^^ + 2 │ aaa + 3 │ ~~~ ~~ + + i code block started here + + > 1 │ ~~~~~~ + │ ^^^^^^ + 2 │ aaa + 3 │ ~~~ ~~ + + i Add closing triple tildes (~~~) at the start of a new line. + + +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-107.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-107.md.snap new file mode 100644 index 000000000000..96a9654b63f3 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-107.md.snap @@ -0,0 +1,40 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-107.md +--- +# Input + +```md +foo +``` +bar +``` +baz + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,7 +1,5 @@ + foo +- + ``` + bar + ``` +- + baz +``` + +# Output + +```md +foo +``` +bar +``` +baz +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-108.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-108.md.snap new file mode 100644 index 000000000000..62e9bab3f28e --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-108.md.snap @@ -0,0 +1,46 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-108.md +--- +# Input + +```md +foo +--- +~~~ +bar +~~~ +# baz + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,7 +1,6 @@ +-## foo +- +-``` ++foo ++--- ++~~~ + bar +-``` +- ++~~~ + # baz +``` + +# Output + +```md +foo +--- +~~~ +bar +~~~ +# baz +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-11.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-11.md.snap new file mode 100644 index 000000000000..6fb3834c3491 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-11.md.snap @@ -0,0 +1,42 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-11.md +--- +# Input + +```md + + +*** +--- +___ + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,7 +1,5 @@ + + ++*** + --- +- +---- +- +---- ++___ +``` + +# Output + +```md + + +*** +--- +___ +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-110.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-110.md.snap new file mode 100644 index 000000000000..6a66e0878853 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-110.md.snap @@ -0,0 +1,40 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-110.md +--- +# Input + +```md +~~~~ ruby startline=3 $%@#$ +def foo(x) + return 3 +end +~~~~~~~ + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,5 +1,5 @@ +-```ruby startline=3 $%@#$ ++~~~~ ruby startline=3 $%@#$ + def foo(x) + return 3 + end +-``` ++~~~~~~~ +``` + +# Output + +```md +~~~~ ruby startline=3 $%@#$ +def foo(x) + return 3 +end +~~~~~~~ +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-111.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-111.md.snap new file mode 100644 index 000000000000..930efd212dc0 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-111.md.snap @@ -0,0 +1,32 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-111.md +--- +# Input + +```md +````; +```` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,2 @@ +-```; +- +-``` ++````; ++```` +``` + +# Output + +```md +````; +```` +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-112.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-112.md.snap new file mode 100644 index 000000000000..10c9e5d6a4b7 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-112.md.snap @@ -0,0 +1,30 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-112.md +--- +# Input + +```md +``` aa ``` +foo + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,2 +1,2 @@ +-`aa` ++``` aa ``` + foo +``` + +# Output + +```md +``` aa ``` +foo +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-113.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-113.md.snap new file mode 100644 index 000000000000..4c4023ee4b6e --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-113.md.snap @@ -0,0 +1,34 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-113.md +--- +# Input + +```md +``` +``` aaa +``` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ +-```` ++``` + ``` aaa +-```` ++``` +``` + +# Output + +```md +``` +``` aaa +``` +``` 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 new file mode 100644 index 000000000000..d91e9644b5f4 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-117.md.snap @@ -0,0 +1,39 @@ +--- +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 new file mode 100644 index 000000000000..f68c46cb6b88 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-120.md.snap @@ -0,0 +1,36 @@ +--- +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-132.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-132.md.snap new file mode 100644 index 000000000000..c2118d00c476 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-132.md.snap @@ -0,0 +1,39 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-132.md +--- +# Input + +```md + + +*foo* + + + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,5 +1,5 @@ + + +-_foo_ ++*foo* + + +``` + +# Output + +```md + + +*foo* + + +``` 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 new file mode 100644 index 000000000000..279d595488aa --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-133.md.snap @@ -0,0 +1,27 @@ +--- +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-14.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-14.md.snap new file mode 100644 index 000000000000..ccb3dc4594d5 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-14.md.snap @@ -0,0 +1,34 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-14.md +--- +# Input + +```md +-- +** +__ + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ + -- +-\*\* +-\_\_ ++** ++__ +``` + +# Output + +```md +-- +** +__ +``` 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 new file mode 100644 index 000000000000..9757e6078f2a --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-140.md.snap @@ -0,0 +1,31 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-140.md +--- +# Input + +```md + +*foo* + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,2 @@ + +- +-_foo_ ++*foo* +``` + +# Output + +```md + +*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 new file mode 100644 index 000000000000..7489e27145a0 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-141.md.snap @@ -0,0 +1,31 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-141.md +--- +# Input + +```md +*bar* +*baz* + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,2 @@ + *bar* +- +-_baz_ ++*baz* +``` + +# Output + +```md +*bar* +*baz* +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-149.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-149.md.snap new file mode 100644 index 000000000000..20aa8072b8cf --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-149.md.snap @@ -0,0 +1,36 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-149.md +--- +# Input + +```md +Foo +
+bar +
+ +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,5 +1,4 @@ + Foo +- +
+ bar +
+``` + +# Output + +```md +Foo +
+bar +
+``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-15.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-15.md.snap new file mode 100644 index 000000000000..5a614f2d94b0 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-15.md.snap @@ -0,0 +1,43 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-15.md +--- +# Input + +```md + + + *** + *** + *** + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,7 +1,5 @@ + + +---- +- +---- +- +---- ++ *** ++ *** ++ *** +``` + +# Output + +```md + + + *** + *** + *** +``` 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 new file mode 100644 index 000000000000..d03efd802a1a --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-152.md.snap @@ -0,0 +1,39 @@ +--- +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-157.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-157.md.snap new file mode 100644 index 000000000000..82799d508308 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-157.md.snap @@ -0,0 +1,39 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-157.md +--- +# Input + +```md + [foo]: + /url + 'the title' + +[foo] + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,5 @@ +-[foo]: /url "the title" ++ [foo]: ++ /url ++ 'the title' + + [foo] +``` + +# Output + +```md + [foo]: + /url + 'the title' + +[foo] +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-158.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-158.md.snap new file mode 100644 index 000000000000..3953288bb247 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-158.md.snap @@ -0,0 +1,33 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-158.md +--- +# Input + +```md +[Foo*bar\]]:my_(url) 'title (with parens)' + +[Foo*bar\]] + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ +-[Foo*bar\]]: my_(url) "title (with parens)" ++[Foo*bar\]]:my_(url) 'title (with parens)' + + [Foo*bar\]] +``` + +# Output + +```md +[Foo*bar\]]:my_(url) 'title (with parens)' + +[Foo*bar\]] +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-159.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-159.md.snap new file mode 100644 index 000000000000..2bc7608c0d58 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-159.md.snap @@ -0,0 +1,39 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-159.md +--- +# Input + +```md +[Foo bar]: + +'title' + +[Foo bar] + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,5 @@ +-[Foo bar]: my%20url "title" ++[Foo bar]: ++ ++'title' + + [Foo bar] +``` + +# Output + +```md +[Foo bar]: + +'title' + +[Foo bar] +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-162.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-162.md.snap new file mode 100644 index 000000000000..94cbbf29ff4b --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-162.md.snap @@ -0,0 +1,36 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-162.md +--- +# Input + +```md +[foo]: +/url + +[foo] + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,4 @@ +-[foo]: /url ++[foo]: ++/url + + [foo] +``` + +# Output + +```md +[foo]: +/url + +[foo] +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-17.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-17.md.snap new file mode 100644 index 000000000000..2817d65f1163 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-17.md.snap @@ -0,0 +1,30 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-17.md +--- +# Input + +```md +Foo + *** + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,2 +1,2 @@ + Foo +-\*\*\* ++ *** +``` + +# Output + +```md +Foo + *** +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-170.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-170.md.snap new file mode 100644 index 000000000000..312736119c32 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-170.md.snap @@ -0,0 +1,37 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-170.md +--- +# Input + +```md +[ +foo +]: /url +bar + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,4 @@ +-[ foo ]: /url +- ++[ ++foo ++]: /url + bar +``` + +# Output + +```md +[ +foo +]: /url +bar +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-176.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-176.md.snap new file mode 100644 index 000000000000..089b969d551e --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-176.md.snap @@ -0,0 +1,34 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-176.md +--- +# Input + +```md +# [Foo] +[foo]: /url +> bar + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,5 +1,3 @@ + # [Foo] +- + [foo]: /url +- + > bar +``` + +# Output + +```md +# [Foo] +[foo]: /url +> bar +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-177.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-177.md.snap new file mode 100644 index 000000000000..d29e5c3e443c --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-177.md.snap @@ -0,0 +1,46 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-177.md +--- +# Input + +```md +[foo]: /foo-url "foo" +[bar]: /bar-url + "bar" +[baz]: /baz-url + +[foo], +[bar], +[baz] + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,5 +1,6 @@ + [foo]: /foo-url "foo" +-[bar]: /bar-url "bar" ++[bar]: /bar-url ++ "bar" + [baz]: /baz-url + + [foo], +``` + +# Output + +```md +[foo]: /foo-url "foo" +[bar]: /bar-url + "bar" +[baz]: /baz-url + +[foo], +[bar], +[baz] +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-18.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-18.md.snap new file mode 100644 index 000000000000..e8a4cdaa5fea --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-18.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-18.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-181.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-181.md.snap new file mode 100644 index 000000000000..88c01b024de1 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-181.md.snap @@ -0,0 +1,35 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-181.md +--- +# Input + +```md +aaa + + +bbb + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,4 @@ + aaa + ++ + bbb +``` + +# Output + +```md +aaa + + +bbb +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-182.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-182.md.snap new file mode 100644 index 000000000000..3a8bf6538f55 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-182.md.snap @@ -0,0 +1,31 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-182.md +--- +# Input + +```md + aaa + bbb + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,2 +1,2 @@ +-aaa +-bbb ++ aaa ++ bbb +``` + +# Output + +```md + aaa + bbb +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-183.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-183.md.snap new file mode 100644 index 000000000000..f9577ab72a22 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-183.md.snap @@ -0,0 +1,34 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-183.md +--- +# Input + +```md +aaa + bbb + ccc + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ + aaa +-bbb +-ccc ++ bbb ++ ccc +``` + +# Output + +```md +aaa + bbb + ccc +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-184.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-184.md.snap new file mode 100644 index 000000000000..460110c5cb00 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-184.md.snap @@ -0,0 +1,30 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-184.md +--- +# Input + +```md + aaa +bbb + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,2 +1,2 @@ +-aaa ++ aaa + bbb +``` + +# Output + +```md + aaa +bbb +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-185.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-185.md.snap new file mode 100644 index 000000000000..f8c6fae8981c --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-185.md.snap @@ -0,0 +1,30 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-185.md +--- +# Input + +```md + aaa +bbb + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,2 @@ + aaa +- + bbb +``` + +# Output + +```md + aaa +bbb +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-186.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-186.md.snap new file mode 100644 index 000000000000..8150206479c1 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-186.md.snap @@ -0,0 +1,31 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-186.md +--- +# Input + +```md +aaa +bbb + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,2 +1,2 @@ +-aaa +-bbb ++aaa ++bbb +``` + +# Output + +```md +aaa +bbb +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-187.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-187.md.snap new file mode 100644 index 000000000000..c866eb8e0141 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-187.md.snap @@ -0,0 +1,47 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-187.md +--- +# Input + +```md + + +aaa + + +# aaa + + + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,8 @@ ++ ++ + aaa ++ + + # aaa ++ ++ +``` + +# Output + +```md + + +aaa + + +# aaa + + +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-188.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-188.md.snap new file mode 100644 index 000000000000..89c51610d98e --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-188.md.snap @@ -0,0 +1,33 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-188.md +--- +# Input + +```md +> # Foo +> bar +> baz + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,4 +1,3 @@ + > # Foo +-> + > bar + > baz +``` + +# Output + +```md +> # Foo +> bar +> baz +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-189.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-189.md.snap new file mode 100644 index 000000000000..501195d28dc5 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-189.md.snap @@ -0,0 +1,35 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-189.md +--- +# Input + +```md +># Foo +>bar +> baz + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,4 +1,3 @@ +-> # Foo +-> +-> bar ++># Foo ++>bar + > baz +``` + +# Output + +```md +># Foo +>bar +> baz +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-19.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-19.md.snap new file mode 100644 index 000000000000..e7533a5d313f --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-19.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-19.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-190.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-190.md.snap new file mode 100644 index 000000000000..09cee5626e41 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-190.md.snap @@ -0,0 +1,36 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-190.md +--- +# Input + +```md + > # Foo + > bar + > baz + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,4 +1,3 @@ +-> # Foo +-> +-> bar +-> baz ++ > # Foo ++ > bar ++ > baz +``` + +# Output + +```md + > # Foo + > bar + > baz +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-192.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-192.md.snap new file mode 100644 index 000000000000..4453957eaa13 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-192.md.snap @@ -0,0 +1,34 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-192.md +--- +# Input + +```md +> # Foo +> bar +baz + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,4 +1,3 @@ + > # Foo +-> + > bar +-> baz ++baz +``` + +# Output + +```md +> # Foo +> bar +baz +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-193.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-193.md.snap new file mode 100644 index 000000000000..3132af615203 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-193.md.snap @@ -0,0 +1,33 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-193.md +--- +# Input + +```md +> bar +baz +> foo + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ + > bar +-> baz ++baz + > foo +``` + +# Output + +```md +> bar +baz +> foo +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-194.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-194.md.snap new file mode 100644 index 000000000000..581c339b5bc6 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-194.md.snap @@ -0,0 +1,30 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-194.md +--- +# Input + +```md +> foo +--- + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,2 @@ + > foo +- + --- +``` + +# Output + +```md +> foo +--- +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-195.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-195.md.snap new file mode 100644 index 000000000000..e3a38864a79a --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-195.md.snap @@ -0,0 +1,30 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-195.md +--- +# Input + +```md +> - foo +- bar + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,2 @@ + > - foo +- + - bar +``` + +# Output + +```md +> - foo +- bar +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-196.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-196.md.snap new file mode 100644 index 000000000000..72cc29f0725c --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-196.md.snap @@ -0,0 +1,30 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-196.md +--- +# Input + +```md +> foo + bar + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,2 @@ + > foo +- + bar +``` + +# Output + +```md +> foo + bar +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-197.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-197.md.snap new file mode 100644 index 000000000000..82d91633ba68 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-197.md.snap @@ -0,0 +1,80 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-197.md +--- +# Input + +```md +> ``` +foo +``` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,7 +1,3 @@ + > ``` +-> foo +-> ``` +- +-``` +- ++foo + ``` +``` + +# Output + +```md +> ``` +foo +``` +``` + +# Errors +``` +example-197.md:1:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Unterminated fenced code block, expected closing triple backticks (```). + + > 1 │ > ``` + │ ^^^ + 2 │ foo + 3 │ ``` + + i code block started here + + > 1 │ > ``` + │ ^^^ + 2 │ foo + 3 │ ``` + + i Add closing triple backticks (```) at the start of a new line. + +example-197.md:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Unterminated fenced code block, expected closing triple backticks (```). + + 1 │ > ``` + 2 │ foo + > 3 │ ``` + │ ^^^ + 4 │ + + i code block started here + + 1 │ > ``` + 2 │ foo + > 3 │ ``` + │ ^^^ + 4 │ + + i Add closing triple backticks (```) at the start of a new line. + + +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-198.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-198.md.snap new file mode 100644 index 000000000000..45a9431a023e --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-198.md.snap @@ -0,0 +1,30 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-198.md +--- +# Input + +```md +> foo + - bar + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,2 @@ + > foo +- + - bar +``` + +# Output + +```md +> foo + - bar +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-2.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-2.md.snap new file mode 100644 index 000000000000..6fd36e30c1bc --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-2.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-2.md +--- +# Input + +```md + foo baz bim + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1 @@ +-foo baz bim ++ foo baz bim +``` + +# Output + +```md + foo baz bim +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-20.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-20.md.snap new file mode 100644 index 000000000000..b985ea3a4a4f --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-20.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-20.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-200.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-200.md.snap new file mode 100644 index 000000000000..db44ce341b6b --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-200.md.snap @@ -0,0 +1,32 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-200.md +--- +# Input + +```md +> +> +> + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1,3 @@ + > ++> ++> +``` + +# Output + +```md +> +> +> +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-201.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-201.md.snap new file mode 100644 index 000000000000..66ec10743d9b --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-201.md.snap @@ -0,0 +1,32 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-201.md +--- +# Input + +```md +> +> foo +> + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1,3 @@ ++> + > foo ++> +``` + +# Output + +```md +> +> foo +> +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-205.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-205.md.snap new file mode 100644 index 000000000000..4c14cc38cae1 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-205.md.snap @@ -0,0 +1,30 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-205.md +--- +# Input + +```md +foo +> bar + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,2 @@ + foo +- + > bar +``` + +# Output + +```md +foo +> bar +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-206.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-206.md.snap new file mode 100644 index 000000000000..25881a0165f0 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-206.md.snap @@ -0,0 +1,35 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-206.md +--- +# Input + +```md +> aaa +*** +> bbb + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,5 +1,3 @@ + > aaa +- +---- +- ++*** + > bbb +``` + +# Output + +```md +> aaa +*** +> bbb +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-207.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-207.md.snap new file mode 100644 index 000000000000..b0478da9a91d --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-207.md.snap @@ -0,0 +1,30 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-207.md +--- +# Input + +```md +> bar +baz + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,2 +1,2 @@ + > bar +-> baz ++baz +``` + +# Output + +```md +> bar +baz +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-209.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-209.md.snap new file mode 100644 index 000000000000..faacdb475d88 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-209.md.snap @@ -0,0 +1,33 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-209.md +--- +# Input + +```md +> bar +> +baz + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ + > bar + > +-> baz ++baz +``` + +# Output + +```md +> bar +> +baz +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-21.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-21.md.snap new file mode 100644 index 000000000000..04e5f391e2bb --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-21.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-21.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-210.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-210.md.snap new file mode 100644 index 000000000000..a4906a4b1580 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-210.md.snap @@ -0,0 +1,30 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-210.md +--- +# Input + +```md +> > > foo +bar + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,2 +1,2 @@ + > > > foo +-> > > bar ++bar +``` + +# Output + +```md +> > > foo +bar +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-211.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-211.md.snap new file mode 100644 index 000000000000..2ac2c2e56429 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-211.md.snap @@ -0,0 +1,35 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-211.md +--- +# Input + +```md +>>> foo +> bar +>>baz + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ +-> > > foo +-> > > bar +-> > > baz ++>>> foo ++> bar ++>>baz +``` + +# Output + +```md +>>> foo +> bar +>>baz +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-212.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-212.md.snap new file mode 100644 index 000000000000..ea5743337182 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-212.md.snap @@ -0,0 +1,33 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-212.md +--- +# Input + +```md +> code + +> not code + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ + > code + +-> not code ++> not code +``` + +# Output + +```md +> code + +> not code +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-217.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-217.md.snap new file mode 100644 index 000000000000..5320f54bb43a --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-217.md.snap @@ -0,0 +1,34 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-217.md +--- +# Input + +```md + - one + + two + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ +-- one ++ - one + +- two ++ two +``` + +# Output + +```md + - one + + two +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-218.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-218.md.snap new file mode 100644 index 000000000000..6ebc0794946c --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-218.md.snap @@ -0,0 +1,34 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-218.md +--- +# Input + +```md + - one + + two + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ +-- one ++ - one + +- two ++ two +``` + +# Output + +```md + - one + + two +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-219.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-219.md.snap new file mode 100644 index 000000000000..0ba50961a783 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-219.md.snap @@ -0,0 +1,35 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-219.md +--- +# Input + +```md + > > 1. one +>> +>> two + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ +-> > 1. one +-> > +-> > two ++ > > 1. one ++>> ++>> two +``` + +# Output + +```md + > > 1. one +>> +>> two +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-22.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-22.md.snap new file mode 100644 index 000000000000..ffbf82fdf288 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-22.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-22.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-220.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-220.md.snap new file mode 100644 index 000000000000..d26fc3c4ea1b --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-220.md.snap @@ -0,0 +1,35 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-220.md +--- +# Input + +```md +>>- one +>> + > > two + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ +-> > - one +-> > +-> > two ++>>- one ++>> ++ > > two +``` + +# Output + +```md +>>- one +>> + > > two +``` 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 new file mode 100644 index 000000000000..9cfc2d965ce8 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-222.md.snap @@ -0,0 +1,88 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-222.md +--- +# Input + +```md +- foo + + bar + +- foo + + + bar + +- ``` + foo + + + bar + ``` + +- baz + + + ``` + foo + + + bar + ``` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -4,6 +4,7 @@ + + - foo + ++ + bar + + - ``` +@@ -14,7 +15,8 @@ + ``` + + - baz +- - ``` ++ ++ + ``` + foo + + +``` + +# Output + +```md +- foo + + bar + +- foo + + + bar + +- ``` + foo + + + bar + ``` + +- baz + + + ``` + foo + + + bar + ``` +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-229.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-229.md.snap new file mode 100644 index 000000000000..267f69905542 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-229.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-229.md +--- +# Input + +```md +003. ok + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1 @@ +-3. ok ++003. ok +``` + +# Output + +```md +003. ok +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-23.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-23.md.snap new file mode 100644 index 000000000000..295c0ff3e397 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-23.md.snap @@ -0,0 +1,38 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-23.md +--- +# Input + +```md +_ _ _ _ a + +a------ + +---a--- + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,4 +1,4 @@ +-\_ \_ \_ \_ a ++_ _ _ _ a + + a------ + +``` + +# Output + +```md +_ _ _ _ a + +a------ + +---a--- +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-232.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-232.md.snap new file mode 100644 index 000000000000..4b21abe203a5 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-232.md.snap @@ -0,0 +1,34 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-232.md +--- +# Input + +```md + 10. foo + + bar + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ +-10. foo ++ 10. foo + +- bar ++ bar +``` + +# Output + +```md + 10. foo + + bar +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-234.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-234.md.snap new file mode 100644 index 000000000000..0fb3b43a2a1a --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-234.md.snap @@ -0,0 +1,41 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-234.md +--- +# Input + +```md +1. indented code + + paragraph + + more code + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,5 +1,5 @@ +-1. indented code ++1. indented code + +- paragraph ++ paragraph + +- more code ++ more code +``` + +# Output + +```md +1. indented code + + paragraph + + more code +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-235.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-235.md.snap new file mode 100644 index 000000000000..d27e849416b0 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-235.md.snap @@ -0,0 +1,41 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-235.md +--- +# Input + +```md +1. indented code + + paragraph + + more code + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,5 +1,5 @@ +-1. indented code ++1. indented code + +- paragraph ++ paragraph + +- more code ++ more code +``` + +# Output + +```md +1. indented code + + paragraph + + more code +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-236.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-236.md.snap new file mode 100644 index 000000000000..af6e128877ec --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-236.md.snap @@ -0,0 +1,33 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-236.md +--- +# Input + +```md + foo + +bar + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ +-foo ++ foo + + bar +``` + +# Output + +```md + foo + +bar +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-237.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-237.md.snap new file mode 100644 index 000000000000..c1e5ef5f190a --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-237.md.snap @@ -0,0 +1,34 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-237.md +--- +# Input + +```md +- foo + + bar + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ +-- foo ++- foo + +-bar ++ bar +``` + +# Output + +```md +- foo + + bar +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-238.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-238.md.snap new file mode 100644 index 000000000000..0c510f35108a --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-238.md.snap @@ -0,0 +1,34 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-238.md +--- +# Input + +```md +- foo + + bar + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ +-- foo ++- foo + +- bar ++ bar +``` + +# Output + +```md +- foo + + bar +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-240.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-240.md.snap new file mode 100644 index 000000000000..d1d6cb8fec84 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-240.md.snap @@ -0,0 +1,33 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-240.md +--- +# Input + +```md +- + + foo + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1,3 @@ +-- foo ++- ++ ++ foo +``` + +# Output + +```md +- + + foo +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-242.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-242.md.snap new file mode 100644 index 000000000000..23895f22eb9d --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-242.md.snap @@ -0,0 +1,33 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-242.md +--- +# Input + +```md +- foo +- +- bar + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ + - foo +-- ++- + - bar +``` + +# Output + +```md +- foo +- +- bar +``` 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 new file mode 100644 index 000000000000..e5b1875a0748 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-244.md.snap @@ -0,0 +1,27 @@ +--- +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-245.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-245.md.snap new file mode 100644 index 000000000000..a5d2095c7c74 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-245.md.snap @@ -0,0 +1,45 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-245.md +--- +# Input + +```md + 1. A paragraph + with two lines. + + indented code + + > A block quote. + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,6 +1,6 @@ +-1. A paragraph +- with two lines. ++ 1. A paragraph ++ with two lines. + +- indented code ++ indented code + +- > A block quote. ++ > A block quote. +``` + +# Output + +```md + 1. A paragraph + with two lines. + + indented code + + > A block quote. +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-246.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-246.md.snap new file mode 100644 index 000000000000..e271c4dad22f --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-246.md.snap @@ -0,0 +1,45 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-246.md +--- +# Input + +```md + 1. A paragraph + with two lines. + + indented code + + > A block quote. + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,6 +1,6 @@ +-1. A paragraph +- with two lines. ++ 1. A paragraph ++ with two lines. + +- indented code ++ indented code + +- > A block quote. ++ > A block quote. +``` + +# Output + +```md + 1. A paragraph + with two lines. + + indented code + + > A block quote. +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-247.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-247.md.snap new file mode 100644 index 000000000000..0515b2afe576 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-247.md.snap @@ -0,0 +1,45 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-247.md +--- +# Input + +```md + 1. A paragraph + with two lines. + + indented code + + > A block quote. + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,6 +1,6 @@ +-1. A paragraph +- with two lines. ++ 1. A paragraph ++ with two lines. + +- indented code ++ indented code + +- > A block quote. ++ > A block quote. +``` + +# Output + +```md + 1. A paragraph + with two lines. + + indented code + + > A block quote. +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-249.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-249.md.snap new file mode 100644 index 000000000000..bd722421b777 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-249.md.snap @@ -0,0 +1,45 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-249.md +--- +# Input + +```md + 1. A paragraph +with two lines. + + indented code + + > A block quote. + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,6 +1,6 @@ +-1. A paragraph +- with two lines. ++ 1. A paragraph ++with two lines. + +- indented code ++ indented code + +- > A block quote. ++ > A block quote. +``` + +# Output + +```md + 1. A paragraph +with two lines. + + indented code + + > A block quote. +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-25.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-25.md.snap new file mode 100644 index 000000000000..4e011bb4eeda --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-25.md.snap @@ -0,0 +1,35 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-25.md +--- +# Input + +```md +- foo +*** +- bar + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,5 +1,3 @@ + - foo +- +---- +- ++*** + - bar +``` + +# Output + +```md +- foo +*** +- bar +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-250.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-250.md.snap new file mode 100644 index 000000000000..b3f5aaae1819 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-250.md.snap @@ -0,0 +1,30 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-250.md +--- +# Input + +```md + 1. A paragraph + with two lines. + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,2 +1,2 @@ +-1. A paragraph ++ 1. A paragraph + with two lines. +``` + +# Output + +```md + 1. A paragraph + with two lines. +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-251.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-251.md.snap new file mode 100644 index 000000000000..c99f5f4f4337 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-251.md.snap @@ -0,0 +1,30 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-251.md +--- +# Input + +```md +> 1. > Blockquote +continued here. + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,2 +1,2 @@ + > 1. > Blockquote +-> > continued here. ++continued here. +``` + +# Output + +```md +> 1. > Blockquote +continued here. +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-252.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-252.md.snap new file mode 100644 index 000000000000..47279662384d --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-252.md.snap @@ -0,0 +1,30 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-252.md +--- +# Input + +```md +> 1. > Blockquote +> continued here. + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,2 +1,2 @@ + > 1. > Blockquote +-> > continued here. ++> continued here. +``` + +# Output + +```md +> 1. > Blockquote +> continued here. +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-254.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-254.md.snap new file mode 100644 index 000000000000..469ab9a053ad --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-254.md.snap @@ -0,0 +1,34 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-254.md +--- +# Input + +```md +- foo + - bar + - baz + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ + - foo +-- bar +-- baz ++ - bar ++ - baz +``` + +# Output + +```md +- foo + - bar + - baz +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-255.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-255.md.snap new file mode 100644 index 000000000000..232a50b78eb3 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-255.md.snap @@ -0,0 +1,30 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-255.md +--- +# Input + +```md +10) foo + - bar + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,2 +1,2 @@ +-10. foo ++10) foo + - bar +``` + +# Output + +```md +10) foo + - bar +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-256.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-256.md.snap new file mode 100644 index 000000000000..283fc305722b --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-256.md.snap @@ -0,0 +1,32 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-256.md +--- +# Input + +```md +10) foo + - bar + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,2 @@ +-10. foo +- +-- bar ++10) foo ++ - bar +``` + +# Output + +```md +10) foo + - bar +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-259.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-259.md.snap new file mode 100644 index 000000000000..496093ea1742 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-259.md.snap @@ -0,0 +1,36 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-259.md +--- +# Input + +```md +- # Foo +- Bar + --- + baz + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,4 @@ + - # Foo +-- ## Bar ++- Bar ++ --- + baz +``` + +# Output + +```md +- # Foo +- Bar + --- + baz +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-26.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-26.md.snap new file mode 100644 index 000000000000..285dce304b03 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-26.md.snap @@ -0,0 +1,35 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-26.md +--- +# Input + +```md +Foo +*** +bar + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,5 +1,3 @@ + Foo +- +---- +- ++*** + bar +``` + +# Output + +```md +Foo +*** +bar +``` 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 new file mode 100644 index 000000000000..1748cf9fc11d --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-260.md.snap @@ -0,0 +1,34 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-260.md +--- +# Input + +```md +- foo +- bar ++ baz + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,4 +1,3 @@ + - foo + - bar +- +-* baz +++ baz +``` + +# Output + +```md +- foo +- bar ++ baz +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-261.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-261.md.snap new file mode 100644 index 000000000000..cba26a87fa3b --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-261.md.snap @@ -0,0 +1,33 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-261.md +--- +# Input + +```md +1. foo +2. bar +3) baz + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,4 +1,3 @@ + 1. foo + 2. bar +- + 3) baz +``` + +# Output + +```md +1. foo +2. bar +3) baz +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-262.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-262.md.snap new file mode 100644 index 000000000000..d9eaa0b41d9d --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-262.md.snap @@ -0,0 +1,33 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-262.md +--- +# Input + +```md +Foo +- bar +- baz + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,4 +1,3 @@ + Foo +- + - bar + - baz +``` + +# Output + +```md +Foo +- bar +- baz +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-263.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-263.md.snap new file mode 100644 index 000000000000..e8762bc5bf4f --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-263.md.snap @@ -0,0 +1,30 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-263.md +--- +# Input + +```md +The number of windows in my house is +14. The number of doors is 6. + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1,2 @@ +-The number of windows in my house is 14. The number of doors is 6. ++The number of windows in my house is ++14. The number of doors is 6. +``` + +# Output + +```md +The number of windows in my house is +14. The number of doors is 6. +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-264.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-264.md.snap new file mode 100644 index 000000000000..109a09add543 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-264.md.snap @@ -0,0 +1,40 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-264.md +--- +# Input + +```md +- foo + +- bar + + +- baz + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -2,4 +2,5 @@ + + - bar + ++ + - baz +``` + +# Output + +```md +- foo + +- bar + + +- baz +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-265.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-265.md.snap new file mode 100644 index 000000000000..dddcf09eac98 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-265.md.snap @@ -0,0 +1,39 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-265.md +--- +# Input + +```md +- foo + + + bar +- baz + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,5 +1,5 @@ + - foo + ++ + bar +- + - baz +``` + +# Output + +```md +- foo + + + bar +- baz +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-266.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-266.md.snap new file mode 100644 index 000000000000..5a0b40c5af9b --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-266.md.snap @@ -0,0 +1,40 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-266.md +--- +# Input + +```md +- foo + - bar + - baz + + + bim + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -2,4 +2,5 @@ + - bar + - baz + ++ + bim +``` + +# Output + +```md +- foo + - bar + - baz + + + bim +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-267.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-267.md.snap new file mode 100644 index 000000000000..44ae4d104c74 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-267.md.snap @@ -0,0 +1,41 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-267.md +--- +# Input + +```md +- foo +- bar + + +- baz +- bim + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,5 +1,6 @@ + - foo + - bar + ++ + - baz + - bim +``` + +# Output + +```md +- foo +- bar + + +- baz +- bim +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-268.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-268.md.snap new file mode 100644 index 000000000000..28aa8a12909a --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-268.md.snap @@ -0,0 +1,51 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-268.md +--- +# Input + +```md +- foo + + notcode + +- foo + + + code + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,7 +1,8 @@ +-- foo ++- foo + +- notcode ++ notcode ++ ++- foo + +-- foo + +- code ++ code +``` + +# Output + +```md +- foo + + notcode + +- foo + + + code +``` 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 new file mode 100644 index 000000000000..048737de7c9b --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-269.md.snap @@ -0,0 +1,57 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-269.md +--- +# Input + +```md +- a + - b + - c + - d + - e + - f + - g + - h +- i + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,9 +1,9 @@ + - a +-- b +-- c +-- d +-- e +-- f +-- g +-- h ++ - b ++ - c ++ - d ++ - e ++ - f ++ - g ++ - h + - i +``` + +# Output + +```md +- a + - b + - c + - d + - e + - f + - g + - h +- i +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-27.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-27.md.snap new file mode 100644 index 000000000000..0e63b9b2f42f --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-27.md.snap @@ -0,0 +1,34 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-27.md +--- +# Input + +```md +Foo +--- +bar + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ +-## Foo +- ++Foo ++--- + bar +``` + +# Output + +```md +Foo +--- +bar +``` 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 new file mode 100644 index 000000000000..2a6609e68c9b --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-272.md.snap @@ -0,0 +1,38 @@ +--- +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-273.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-273.md.snap new file mode 100644 index 000000000000..bfc2b8222ee1 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-273.md.snap @@ -0,0 +1,38 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-273.md +--- +# Input + +```md +- a +- b + + c +- d + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -2,5 +2,4 @@ + - b + + c +- + - d +``` + +# Output + +```md +- a +- b + + c +- d +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-274.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-274.md.snap new file mode 100644 index 000000000000..44f4d9326755 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-274.md.snap @@ -0,0 +1,38 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-274.md +--- +# Input + +```md +- a +- b + + [ref]: /url +- d + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -2,5 +2,4 @@ + - b + + [ref]: /url +- + - d +``` + +# Output + +```md +- a +- b + + [ref]: /url +- d +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-276.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-276.md.snap new file mode 100644 index 000000000000..cbe170b9029e --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-276.md.snap @@ -0,0 +1,38 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-276.md +--- +# Input + +```md +- a + - b + + c +- d + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -2,5 +2,4 @@ + - b + + c +- + - d +``` + +# Output + +```md +- a + - b + + c +- d +``` 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 new file mode 100644 index 000000000000..b343c40913a9 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-277.md.snap @@ -0,0 +1,37 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-277.md +--- +# Input + +```md +* a + > b + > +* c + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,4 @@ +-- a ++* a + > b +-- c ++ > ++* c +``` + +# Output + +```md +* a + > b + > +* 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 new file mode 100644 index 000000000000..0ec5fa7f3438 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-28.md.snap @@ -0,0 +1,37 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-28.md +--- +# Input + +```md +* Foo +* * * +* Bar + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,5 +1,3 @@ +-- Foo +- +---- +- +-- Bar ++* Foo ++* * * ++* Bar +``` + +# Output + +```md +* Foo +* * * +* 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 new file mode 100644 index 000000000000..b884bb2fc18f --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-282.md.snap @@ -0,0 +1,37 @@ +--- +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-286.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-286.md.snap new file mode 100644 index 000000000000..4dbe33982a24 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-286.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-286.md +--- +# Input + +```md +\ \A\a\ \3\φ\« + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1 @@ +-\ \A\a\ \3\φ\« ++\ \A\a\ \3\φ\« +``` + +# Output + +```md +\ \A\a\ \3\φ\« +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-287.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-287.md.snap new file mode 100644 index 000000000000..7095f1a470df --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-287.md.snap @@ -0,0 +1,49 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-287.md +--- +# Input + +```md +\*not emphasized* +\
not a tag +\[not a link](/foo) +\`not code` +1\. not a list +\* not a list +\# not a heading +\[foo]: /url "not a reference" + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,7 +1,8 @@ +-\*not emphasized\* ++\*not emphasized* + \
not a tag + \[not a link](/foo) + \`not code` +-1\. not a list \* not a list ++1\. not a list ++\* not a list + \# not a heading + \[foo]: /url "not a reference" +``` + +# Output + +```md +\*not emphasized* +\
not a tag +\[not a link](/foo) +\`not code` +1\. not a list +\* not a list +\# not a heading +\[foo]: /url "not a reference" +``` 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 new file mode 100644 index 000000000000..84829406eafa --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-288.md.snap @@ -0,0 +1,27 @@ +--- +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-29.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-29.md.snap new file mode 100644 index 000000000000..482692068091 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-29.md.snap @@ -0,0 +1,30 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-29.md +--- +# Input + +```md +- Foo +- * * * + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,2 +1,2 @@ + - Foo +-- *** ++- * * * +``` + +# Output + +```md +- Foo +- * * * +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-292.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-292.md.snap new file mode 100644 index 000000000000..3a829a762c56 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-292.md.snap @@ -0,0 +1,34 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-292.md +--- +# Input + +```md +~~~ +\[\] +~~~ + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ +-``` ++~~~ + \[\] +-``` ++~~~ +``` + +# Output + +```md +~~~ +\[\] +~~~ +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-295.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-295.md.snap new file mode 100644 index 000000000000..482ea3547583 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-295.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-295.md +--- +# Input + +```md +[foo](/bar\* "ti\*tle") + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1 @@ +-[foo](/bar* "ti*tle") ++[foo](/bar\* "ti\*tle") +``` + +# Output + +```md +[foo](/bar\* "ti\*tle") +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-296.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-296.md.snap new file mode 100644 index 000000000000..0e6e67fa0eac --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-296.md.snap @@ -0,0 +1,33 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-296.md +--- +# Input + +```md +[foo] + +[foo]: /bar\* "ti\*tle" + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ + [foo] + +-[foo]: /bar* "ti*tle" ++[foo]: /bar\* "ti\*tle" +``` + +# Output + +```md +[foo] + +[foo]: /bar\* "ti\*tle" +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-297.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-297.md.snap new file mode 100644 index 000000000000..db4f3eff5dc8 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-297.md.snap @@ -0,0 +1,33 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-297.md +--- +# Input + +```md +``` foo\+bar +foo +``` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ +-```foo+bar ++``` foo\+bar + foo + ``` +``` + +# Output + +```md +``` foo\+bar +foo +``` +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-298.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-298.md.snap new file mode 100644 index 000000000000..c5a5c53d4a5b --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-298.md.snap @@ -0,0 +1,33 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-298.md +--- +# Input + +```md +  & © Æ Ď +¾ ℋ ⅆ +∲ ≧̸ + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ +   & © Æ Ď + ¾ ℋ ⅆ +-∲ ≧̸ ++∲ ≧̸ +``` + +# Output + +```md +  & © Æ Ď +¾ ℋ ⅆ +∲ ≧̸ +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-30.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-30.md.snap new file mode 100644 index 000000000000..a2b6db584e1a --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-30.md.snap @@ -0,0 +1,46 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-30.md +--- +# Input + +```md +# foo +## foo +### foo +#### foo +##### foo +###### foo + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,11 +1,6 @@ + # foo +- + ## foo +- + ### foo +- + #### foo +- + ##### foo +- + ###### foo +``` + +# Output + +```md +# foo +## foo +### foo +#### foo +##### foo +###### foo +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-305.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-305.md.snap new file mode 100644 index 000000000000..33d2b1398f73 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-305.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-305.md +--- +# Input + +```md +[foo](/föö "föö") + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1 @@ +-[foo](/föö "föö") ++[foo](/föö "föö") +``` + +# Output + +```md +[foo](/föö "föö") +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-306.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-306.md.snap new file mode 100644 index 000000000000..fb0f028c5d9b --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-306.md.snap @@ -0,0 +1,33 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-306.md +--- +# Input + +```md +[foo] + +[foo]: /föö "föö" + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ + [foo] + +-[foo]: /föö "föö" ++[foo]: /föö "föö" +``` + +# Output + +```md +[foo] + +[foo]: /föö "föö" +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-307.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-307.md.snap new file mode 100644 index 000000000000..4e654415b9ec --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-307.md.snap @@ -0,0 +1,33 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-307.md +--- +# Input + +```md +``` föö +foo +``` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ +-```föö ++``` föö + foo + ``` +``` + +# Output + +```md +``` föö +foo +``` +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-311.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-311.md.snap new file mode 100644 index 000000000000..728a56d6fde3 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-311.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-311.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-313.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-313.md.snap new file mode 100644 index 000000000000..32f3ab2b6e22 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-313.md.snap @@ -0,0 +1,33 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-313.md +--- +# Input + +```md +`` +foo +`` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1,3 @@ +-`foo` ++`` ++foo ++`` +``` + +# Output + +```md +`` +foo +`` +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-317.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-317.md.snap new file mode 100644 index 000000000000..c53d64f3507c --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-317.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-317.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-325.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-325.md.snap new file mode 100644 index 000000000000..d462671b874e --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-325.md.snap @@ -0,0 +1,27 @@ +--- +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-326.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-326.md.snap new file mode 100644 index 000000000000..e2ef8650cfe2 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-326.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-326.md +--- +# Input + +```md +a * foo bar* + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1 @@ +-a _ foo bar_ ++a * foo bar* +``` + +# Output + +```md +a * foo bar* +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-328.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-328.md.snap new file mode 100644 index 000000000000..393b5c1f0602 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-328.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-328.md +--- +# Input + +```md +* a * + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1 @@ +-_ a _ ++* a * +``` + +# Output + +```md +* a * +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-33.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-33.md.snap new file mode 100644 index 000000000000..628a34aa458d --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-33.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-33.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-333.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-333.md.snap new file mode 100644 index 000000000000..063e15b60047 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-333.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-333.md +--- +# Input + +```md +a_"foo"_ + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1 @@ +-a*"foo"* ++a_"foo"_ +``` + +# Output + +```md +a_"foo"_ +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-334.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-334.md.snap new file mode 100644 index 000000000000..dca3934fec29 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-334.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-334.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-336.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-336.md.snap new file mode 100644 index 000000000000..f3109a1d21d9 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-336.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-336.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-337.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-337.md.snap new file mode 100644 index 000000000000..a970437d8fc2 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-337.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-337.md +--- +# Input + +```md +aa_"bb"_cc + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1 @@ +-aa\_"bb"\_cc ++aa_"bb"_cc +``` + +# Output + +```md +aa_"bb"_cc +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-339.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-339.md.snap new file mode 100644 index 000000000000..4b6958536445 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-339.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-339.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-340.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-340.md.snap new file mode 100644 index 000000000000..d2dc140d7e97 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-340.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-340.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-341.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-341.md.snap new file mode 100644 index 000000000000..f9213ce84eb2 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-341.md.snap @@ -0,0 +1,32 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-341.md +--- +# Input + +```md +*foo bar +* + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,2 @@ +-\*foo bar +- +-- ++*foo bar ++* +``` + +# Output + +```md +*foo bar +* +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-346.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-346.md.snap new file mode 100644 index 000000000000..13cb4d883e70 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-346.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-346.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-347.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-347.md.snap new file mode 100644 index 000000000000..7b01a8c15b76 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-347.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-347.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-348.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-348.md.snap new file mode 100644 index 000000000000..2a0dec8097b3 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-348.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-348.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-349.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-349.md.snap new file mode 100644 index 000000000000..12dbd6ddc1a0 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-349.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-349.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-35.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-35.md.snap new file mode 100644 index 000000000000..5c2dce38aceb --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-35.md.snap @@ -0,0 +1,27 @@ +--- +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 new file mode 100644 index 000000000000..80b5b3778abb --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-356.md.snap @@ -0,0 +1,27 @@ +--- +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-357.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-357.md.snap new file mode 100644 index 000000000000..107339b675e1 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-357.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-357.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-358.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-358.md.snap new file mode 100644 index 000000000000..7652ac26ebdb --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-358.md.snap @@ -0,0 +1,31 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-358.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-359.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-359.md.snap new file mode 100644 index 000000000000..3ecac2df8428 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-359.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-359.md +--- +# Input + +```md +a__"foo"__ + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1 @@ +-a**"foo"** ++a__"foo"__ +``` + +# Output + +```md +a__"foo"__ +``` 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 new file mode 100644 index 000000000000..b61ab81cadff --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-36.md.snap @@ -0,0 +1,27 @@ +--- +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 +``` + +# Output + +```md +# foo +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-360.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-360.md.snap new file mode 100644 index 000000000000..9beeb2b8f4e3 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-360.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-360.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-361.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-361.md.snap new file mode 100644 index 000000000000..4fa2c4b3edc3 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-361.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-361.md +--- +# Input + +```md +5__6__78 + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1 @@ +-5**6**78 ++5__6__78 +``` + +# Output + +```md +5__6__78 +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-362.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-362.md.snap new file mode 100644 index 000000000000..f10bf8784383 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-362.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-362.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-363.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-363.md.snap new file mode 100644 index 000000000000..5715a7f34b22 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-363.md.snap @@ -0,0 +1,27 @@ +--- +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 new file mode 100644 index 000000000000..a3cbc3fc6e5e --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-364.md.snap @@ -0,0 +1,27 @@ +--- +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 new file mode 100644 index 000000000000..ecd0af1d23c2 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-367.md.snap @@ -0,0 +1,27 @@ +--- +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 new file mode 100644 index 000000000000..c2f9917c9f6e --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-368.md.snap @@ -0,0 +1,31 @@ +--- +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 new file mode 100644 index 000000000000..6ad4c9188956 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-369.md.snap @@ -0,0 +1,27 @@ +--- +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-37.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-37.md.snap new file mode 100644 index 000000000000..af6a6d9a1e88 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-37.md.snap @@ -0,0 +1,37 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-37.md +--- +# Input + +```md + ### foo + ## foo + # foo + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,5 +1,3 @@ +-### foo +- +-## foo +- +-# foo ++ ### foo ++ ## foo ++ # foo +``` + +# Output + +```md + ### foo + ## foo + # foo +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-371.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-371.md.snap new file mode 100644 index 000000000000..50a06a2ddaae --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-371.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-371.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-372.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-372.md.snap new file mode 100644 index 000000000000..2bc501fae37c --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-372.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-372.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-373.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-373.md.snap new file mode 100644 index 000000000000..8c4e9dac7cb2 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-373.md.snap @@ -0,0 +1,27 @@ +--- +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-374.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-374.md.snap new file mode 100644 index 000000000000..d49c8dde7941 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-374.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-374.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-375.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-375.md.snap new file mode 100644 index 000000000000..68f050e73a92 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-375.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-375.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-376.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-376.md.snap new file mode 100644 index 000000000000..4ffe490880a9 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-376.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-376.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-377.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-377.md.snap new file mode 100644 index 000000000000..01b1826621ce --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-377.md.snap @@ -0,0 +1,27 @@ +--- +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 new file mode 100644 index 000000000000..07934cb14dc3 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-378.md.snap @@ -0,0 +1,27 @@ +--- +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 new file mode 100644 index 000000000000..8b105a5aa4f8 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-379.md.snap @@ -0,0 +1,31 @@ +--- +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 new file mode 100644 index 000000000000..f76a5ee41996 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-380.md.snap @@ -0,0 +1,27 @@ +--- +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-381.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-381.md.snap new file mode 100644 index 000000000000..e20f121721a7 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-381.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-381.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-382.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-382.md.snap new file mode 100644 index 000000000000..b3bef349c952 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-382.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-382.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-383.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-383.md.snap new file mode 100644 index 000000000000..e73a541f52bc --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-383.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-383.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-384.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-384.md.snap new file mode 100644 index 000000000000..20f38533558c --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-384.md.snap @@ -0,0 +1,27 @@ +--- +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 new file mode 100644 index 000000000000..e8c3cabd1031 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-385.md.snap @@ -0,0 +1,27 @@ +--- +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 new file mode 100644 index 000000000000..0f450331d19f --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-386.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-386.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-387.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-387.md.snap new file mode 100644 index 000000000000..70ca6a586a90 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-387.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-387.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-388.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-388.md.snap new file mode 100644 index 000000000000..4713e4e85da2 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-388.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-388.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-39.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-39.md.snap new file mode 100644 index 000000000000..4ade815c4f39 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-39.md.snap @@ -0,0 +1,30 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-39.md +--- +# Input + +```md +foo + # bar + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1,2 @@ +-foo # bar ++foo ++ # bar +``` + +# Output + +```md +foo + # bar +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-391.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-391.md.snap new file mode 100644 index 000000000000..a0b5f541d48d --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-391.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-391.md +--- +# Input + +```md +** is not an empty emphasis + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1 @@ +-\*\* is not an empty emphasis ++** is not an empty emphasis +``` + +# Output + +```md +** is not an empty emphasis +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-392.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-392.md.snap new file mode 100644 index 000000000000..782c867e7639 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-392.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-392.md +--- +# Input + +```md +**** is not an empty strong emphasis + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1 @@ +-\*\*\*\* is not an empty strong emphasis ++**** is not an empty strong emphasis +``` + +# Output + +```md +**** is not an empty strong emphasis +``` 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 new file mode 100644 index 000000000000..1c45a088a973 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-395.md.snap @@ -0,0 +1,27 @@ +--- +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 new file mode 100644 index 000000000000..24ae61c68ee4 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-396.md.snap @@ -0,0 +1,27 @@ +--- +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 new file mode 100644 index 000000000000..a76bd85828b8 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-397.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-397.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-398.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-398.md.snap new file mode 100644 index 000000000000..f017058e14cf --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-398.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-398.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-399.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-399.md.snap new file mode 100644 index 000000000000..d8c6c29e95ba --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-399.md.snap @@ -0,0 +1,27 @@ +--- +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-4.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-4.md.snap new file mode 100644 index 000000000000..355d9c91cc07 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-4.md.snap @@ -0,0 +1,34 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-4.md +--- +# Input + +```md + - foo + + bar + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ +-- foo ++ - foo + +- bar ++ bar +``` + +# Output + +```md + - foo + + bar +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-40.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-40.md.snap new file mode 100644 index 000000000000..977d3ee2440f --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-40.md.snap @@ -0,0 +1,32 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-40.md +--- +# Input + +```md +## foo ## + ### bar ### + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,2 @@ +-## foo +- +-### bar ++## foo ## ++ ### bar ### +``` + +# Output + +```md +## foo ## + ### bar ### +``` 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 new file mode 100644 index 000000000000..68ec1eb47554 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-401.md.snap @@ -0,0 +1,27 @@ +--- +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 new file mode 100644 index 000000000000..3937d8413ce0 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-402.md.snap @@ -0,0 +1,27 @@ +--- +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 new file mode 100644 index 000000000000..3cb8364b0302 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-403.md.snap @@ -0,0 +1,31 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-403.md +--- +# Input + +```md +**foo *bar **baz** +bim* bop** + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,2 +1,2 @@ +-**foo \*bar **baz** +-bim\* bop** ++**foo *bar **baz** ++bim* bop** +``` + +# Output + +```md +**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 new file mode 100644 index 000000000000..40d5dba4f486 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-404.md.snap @@ -0,0 +1,27 @@ +--- +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-405.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-405.md.snap new file mode 100644 index 000000000000..d6107672d608 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-405.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-405.md +--- +# Input + +```md +__ is not an empty emphasis + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1 @@ +-\_\_ is not an empty emphasis ++__ is not an empty emphasis +``` + +# Output + +```md +__ is not an empty emphasis +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-406.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-406.md.snap new file mode 100644 index 000000000000..7ab283c78281 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-406.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-406.md +--- +# Input + +```md +____ is not an empty strong emphasis + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1 @@ +-\_\_\_\_ is not an empty strong emphasis ++____ is not an empty strong emphasis +``` + +# Output + +```md +____ is not an empty strong emphasis +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-407.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-407.md.snap new file mode 100644 index 000000000000..744a748090ba --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-407.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-407.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-408.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-408.md.snap new file mode 100644 index 000000000000..ce936e52cc37 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-408.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-408.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-41.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-41.md.snap new file mode 100644 index 000000000000..2e29a4d64fcc --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-41.md.snap @@ -0,0 +1,32 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-41.md +--- +# Input + +```md +# foo ################################## +##### foo ## + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,2 @@ +-# foo +- +-##### foo ++# foo ################################## ++##### foo ## +``` + +# Output + +```md +# foo ################################## +##### foo ## +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-410.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-410.md.snap new file mode 100644 index 000000000000..3bfc8c4ecfba --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-410.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-410.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-412.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-412.md.snap new file mode 100644 index 000000000000..bd971af62bc4 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-412.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-412.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-413.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-413.md.snap new file mode 100644 index 000000000000..199e8a6e7d81 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-413.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-413.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-414.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-414.md.snap new file mode 100644 index 000000000000..33aef1ff0676 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-414.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-414.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-415.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-415.md.snap new file mode 100644 index 000000000000..16654a98291f --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-415.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-415.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-417.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-417.md.snap new file mode 100644 index 000000000000..fa04bbbd1f22 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-417.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-417.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-418.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-418.md.snap new file mode 100644 index 000000000000..fe99f2deea89 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-418.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-418.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-419.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-419.md.snap new file mode 100644 index 000000000000..5c5b73ae5f0b --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-419.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-419.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-42.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-42.md.snap new file mode 100644 index 000000000000..85e39adf1e50 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-42.md.snap @@ -0,0 +1,27 @@ +--- +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 ### +``` + +# Output + +```md +### foo ### +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-420.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-420.md.snap new file mode 100644 index 000000000000..c714edac1eb7 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-420.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-420.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-421.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-421.md.snap new file mode 100644 index 000000000000..2fac0c460520 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-421.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-421.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-422.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-422.md.snap new file mode 100644 index 000000000000..a39366d5231a --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-422.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-422.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-423.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-423.md.snap new file mode 100644 index 000000000000..ade693dcd7eb --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-423.md.snap @@ -0,0 +1,27 @@ +--- +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 new file mode 100644 index 000000000000..b97adcc6113f --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-424.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-424.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-425.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-425.md.snap new file mode 100644 index 000000000000..b593a9a92ebf --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-425.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-425.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-426.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-426.md.snap new file mode 100644 index 000000000000..85f7b7bd11e4 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-426.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-426.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-427.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-427.md.snap new file mode 100644 index 000000000000..be90eb898da7 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-427.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-427.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-428.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-428.md.snap new file mode 100644 index 000000000000..eb5202b2ceec --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-428.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-428.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-429.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-429.md.snap new file mode 100644 index 000000000000..af8e0aa4e05a --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-429.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-429.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-430.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-430.md.snap new file mode 100644 index 000000000000..30ed0b8ff5ab --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-430.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-430.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-432.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-432.md.snap new file mode 100644 index 000000000000..19ce1186710e --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-432.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-432.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-433.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-433.md.snap new file mode 100644 index 000000000000..2b2967df8efb --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-433.md.snap @@ -0,0 +1,27 @@ +--- +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-435.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-435.md.snap new file mode 100644 index 000000000000..a0f009d9639c --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-435.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-435.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 new file mode 100644 index 000000000000..d7a8a8de0afd --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-436.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-436.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-437.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-437.md.snap new file mode 100644 index 000000000000..41d63c029456 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-437.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-437.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-438.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-438.md.snap new file mode 100644 index 000000000000..e7698ef7098b --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-438.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-438.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-439.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-439.md.snap new file mode 100644 index 000000000000..531c5c266e87 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-439.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-439.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-440.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-440.md.snap new file mode 100644 index 000000000000..d38d1f7eb675 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-440.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-440.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-441.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-441.md.snap new file mode 100644 index 000000000000..5740ad338f85 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-441.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-441.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-442.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-442.md.snap new file mode 100644 index 000000000000..6d259b9c789f --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-442.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-442.md +--- +# Input + +```md +*foo __bar *baz bim__ bam* + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1 @@ +-*foo \_\_bar *baz bim\_\_ bam\* ++*foo __bar *baz bim__ bam* +``` + +# Output + +```md +*foo __bar *baz bim__ bam* +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-443.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-443.md.snap new file mode 100644 index 000000000000..dda01f5bd8d9 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-443.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-443.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-444.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-444.md.snap new file mode 100644 index 000000000000..48efdf410aff --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-444.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-444.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-445.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-445.md.snap new file mode 100644 index 000000000000..aa531ff1e0a0 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-445.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-445.md +--- +# Input + +```md +*[bar*](/url) + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1 @@ +-_[bar_](/url) ++*[bar*](/url) +``` + +# Output + +```md +*[bar*](/url) +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-447.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-447.md.snap new file mode 100644 index 000000000000..4f4080279971 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-447.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-447.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-449.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-449.md.snap new file mode 100644 index 000000000000..0d851dbeff25 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-449.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-449.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-45.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-45.md.snap new file mode 100644 index 000000000000..19ad9f63fb2d --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-45.md.snap @@ -0,0 +1,34 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-45.md +--- +# Input + +```md +### foo \### +## foo #\## +# foo \# + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,5 +1,3 @@ + ### foo \### +- + ## foo #\## +- + # foo \# +``` + +# Output + +```md +### foo \### +## foo #\## +# foo \# +``` 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 new file mode 100644 index 000000000000..f8774a2c6ebb --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-450.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-450.md +--- +# Input + +```md +*a `*`* + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1 @@ +-_a `_`\* ++*a `*`* +``` + +# Output + +```md +*a `*`* +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-451.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-451.md.snap new file mode 100644 index 000000000000..2802aef3bff4 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-451.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-451.md +--- +# Input + +```md +_a `_`_ + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1 @@ +-_a `_`\_ ++_a `_`_ +``` + +# Output + +```md +_a `_`_ +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-453.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-453.md.snap new file mode 100644 index 000000000000..9e10631f3a77 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-453.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-453.md +--- +# Input + +```md +__a + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1 @@ +-**a ++__a +``` + +# Output + +```md +__a +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-457.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-457.md.snap new file mode 100644 index 000000000000..5b598d7fbdc0 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-457.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-457.md +--- +# Input + +```md +[link](<>) + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1 @@ +-[link]() ++[link](<>) +``` + +# Output + +```md +[link](<>) +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-46.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-46.md.snap new file mode 100644 index 000000000000..7b0c148e3f87 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-46.md.snap @@ -0,0 +1,42 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-46.md +--- +# Input + +```md + + +**** +## foo +**** + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,7 +1,5 @@ + + +---- +- ++**** + ## foo +- +---- ++**** +``` + +# Output + +```md + + +**** +## foo +**** +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-462.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-462.md.snap new file mode 100644 index 000000000000..9e37b6650e4a --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-462.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-462.md +--- +# Input + +```md +[link](\(foo\)) + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1 @@ +-[link](<(foo)>) ++[link](\(foo\)) +``` + +# Output + +```md +[link](\(foo\)) +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-463.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-463.md.snap new file mode 100644 index 000000000000..fad2265de544 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-463.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-463.md +--- +# Input + +```md +[link]((foo)and(bar)) + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1 @@ +-[link](<(foo)and(bar)>) ++[link]((foo)and(bar)) +``` + +# Output + +```md +[link]((foo)and(bar)) +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-464.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-464.md.snap new file mode 100644 index 000000000000..c5eead1763a7 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-464.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-464.md +--- +# Input + +```md +[link](foo(and(bar))) + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1 @@ +-[link]() ++[link](foo(and(bar))) +``` + +# Output + +```md +[link](foo(and(bar))) +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-465.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-465.md.snap new file mode 100644 index 000000000000..c89ef002f2e2 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-465.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-465.md +--- +# Input + +```md +[link](foo(and\(bar\))) + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1 @@ +-[link]() ++[link](foo(and\(bar\))) +``` + +# Output + +```md +[link](foo(and\(bar\))) +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-467.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-467.md.snap new file mode 100644 index 000000000000..c430afddecd9 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-467.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-467.md +--- +# Input + +```md +[link](foo\)\:) + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1 @@ +-[link]() ++[link](foo\)\:) +``` + +# Output + +```md +[link](foo\)\:) +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-47.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-47.md.snap new file mode 100644 index 000000000000..b8b0297bbae4 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-47.md.snap @@ -0,0 +1,34 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-47.md +--- +# Input + +```md +Foo bar +# baz +Bar foo + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,5 +1,3 @@ + Foo bar +- + # baz +- + Bar foo +``` + +# Output + +```md +Foo bar +# baz +Bar foo +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-470.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-470.md.snap new file mode 100644 index 000000000000..94a68394feb5 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-470.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-470.md +--- +# Input + +```md +[link](foo%20bä) + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1 @@ +-[link](foo%20bä) ++[link](foo%20bä) +``` + +# Output + +```md +[link](foo%20bä) +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-472.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-472.md.snap new file mode 100644 index 000000000000..fb1aa9350cd9 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-472.md.snap @@ -0,0 +1,34 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-472.md +--- +# Input + +```md +[link](/url "title") +[link](/url 'title') +[link](/url (title)) + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ + [link](/url "title") +-[link](/url "title") +-[link](/url "title") ++[link](/url 'title') ++[link](/url (title)) +``` + +# Output + +```md +[link](/url "title") +[link](/url 'title') +[link](/url (title)) +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-473.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-473.md.snap new file mode 100644 index 000000000000..fb49432e5173 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-473.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-473.md +--- +# Input + +```md +[link](/url "title \""") + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1 @@ +-[link](/url 'title ""') ++[link](/url "title \""") +``` + +# Output + +```md +[link](/url "title \""") +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-476.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-476.md.snap new file mode 100644 index 000000000000..660f1a428f9b --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-476.md.snap @@ -0,0 +1,30 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-476.md +--- +# Input + +```md +[link]( /uri + "title" ) + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1,2 @@ +-[link](/uri "title") ++[link]( /uri ++ "title" ) +``` + +# Output + +```md +[link]( /uri + "title" ) +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-48.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-48.md.snap new file mode 100644 index 000000000000..acbf7364a34a --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-48.md.snap @@ -0,0 +1,36 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-48.md +--- +# Input + +```md +## +# +### ### + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,5 +1,3 @@ +-## +- ++## + # +- +-### ++### ### +``` + +# Output + +```md +## +# +### ### +``` 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 new file mode 100644 index 000000000000..a4573f530bf1 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-482.md.snap @@ -0,0 +1,27 @@ +--- +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 new file mode 100644 index 000000000000..b3d54c5d5000 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-485.md.snap @@ -0,0 +1,27 @@ +--- +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-487.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-487.md.snap new file mode 100644 index 000000000000..2845ae6dd0a9 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-487.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-487.md +--- +# Input + +```md +*[foo*](/uri) + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1 @@ +-_[foo_](/uri) ++*[foo*](/uri) +``` + +# Output + +```md +*[foo*](/uri) +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-488.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-488.md.snap new file mode 100644 index 000000000000..8fb2eaff63ef --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-488.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-488.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-489.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-489.md.snap new file mode 100644 index 000000000000..9adeb783894f --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-489.md.snap @@ -0,0 +1,27 @@ +--- +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-49.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-49.md.snap new file mode 100644 index 000000000000..ae0cbfbffbf3 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-49.md.snap @@ -0,0 +1,40 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-49.md +--- +# Input + +```md +Foo *bar* +========= + +Foo *bar* +--------- + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,5 @@ +-# Foo _bar_ ++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-496.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-496.md.snap new file mode 100644 index 000000000000..d5b428dbfd54 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-496.md.snap @@ -0,0 +1,33 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-496.md +--- +# Input + +```md +[link *foo **bar** `#`*][ref] + +[ref]: /uri + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ +-[link _foo **bar** `#`_][ref] ++[link *foo **bar** `#`*][ref] + + [ref]: /uri +``` + +# Output + +```md +[link *foo **bar** `#`*][ref] + +[ref]: /uri +``` 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 new file mode 100644 index 000000000000..503e4f7be16b --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-499.md.snap @@ -0,0 +1,33 @@ +--- +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-5.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-5.md.snap new file mode 100644 index 000000000000..f301c01c8ce5 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-5.md.snap @@ -0,0 +1,33 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-5.md +--- +# Input + +```md +- foo + + bar + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ + - foo + +- bar ++ bar +``` + +# Output + +```md +- foo + + bar +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-50.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-50.md.snap new file mode 100644 index 000000000000..b38156c0338b --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-50.md.snap @@ -0,0 +1,34 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-50.md +--- +# Input + +```md +Foo *bar +baz* +==== + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ +-Foo _bar +-baz_ ++Foo *bar ++baz* + ==== +``` + +# Output + +```md +Foo *bar +baz* +==== +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-500.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-500.md.snap new file mode 100644 index 000000000000..f905e66111a7 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-500.md.snap @@ -0,0 +1,33 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-500.md +--- +# Input + +```md +*[foo*][ref] + +[ref]: /uri + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ +-_[foo_][ref] ++*[foo*][ref] + + [ref]: /uri +``` + +# Output + +```md +*[foo*][ref] + +[ref]: /uri +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-501.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-501.md.snap new file mode 100644 index 000000000000..2cf14911f680 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-501.md.snap @@ -0,0 +1,33 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-501.md +--- +# Input + +```md +[foo *bar][ref] + +[ref]: /uri + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ +-[foo \*bar][ref] ++[foo *bar][ref] + + [ref]: /uri +``` + +# Output + +```md +[foo *bar][ref] + +[ref]: /uri +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-507.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-507.md.snap new file mode 100644 index 000000000000..78c16b1ec0f2 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-507.md.snap @@ -0,0 +1,36 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-507.md +--- +# Input + +```md +[Foo + bar]: /url + +[Baz][Foo bar] + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,4 @@ +-[Foo bar]: /url ++[Foo ++ bar]: /url + + [Baz][Foo bar] +``` + +# Output + +```md +[Foo + bar]: /url + +[Baz][Foo bar] +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-51.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-51.md.snap new file mode 100644 index 000000000000..c1d8e7ac2965 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-51.md.snap @@ -0,0 +1,40 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-51.md +--- +# Input + +```md +Foo +------------------------- + +Foo += + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,5 @@ +-## Foo ++Foo ++------------------------- + +-# Foo ++Foo ++= +``` + +# Output + +```md +Foo +------------------------- + +Foo += +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-510.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-510.md.snap new file mode 100644 index 000000000000..bd33b006a56f --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-510.md.snap @@ -0,0 +1,38 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-510.md +--- +# Input + +```md +[foo]: /url1 + +[foo]: /url2 + +[bar][foo] + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,4 +1,5 @@ + [foo]: /url1 ++ + [foo]: /url2 + + [bar][foo] +``` + +# Output + +```md +[foo]: /url1 + +[foo]: /url2 + +[bar][foo] +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-512.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-512.md.snap new file mode 100644 index 000000000000..11516b365938 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-512.md.snap @@ -0,0 +1,33 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-512.md +--- +# Input + +```md +[foo][ref[] + +[ref[]: /uri + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ +-[foo]ref[] ++[foo][ref[] + + [ref[]: /uri +``` + +# Output + +```md +[foo][ref[] + +[ref[]: /uri +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-513.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-513.md.snap new file mode 100644 index 000000000000..c31b2b6b2891 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-513.md.snap @@ -0,0 +1,33 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-513.md +--- +# Input + +```md +[foo][ref[bar]] + +[ref[bar]]: /uri + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ +-[foo]ref[bar]] ++[foo][ref[bar]] + + [ref[bar]]: /uri +``` + +# Output + +```md +[foo][ref[bar]] + +[ref[bar]]: /uri +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-518.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-518.md.snap new file mode 100644 index 000000000000..b3447df12902 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-518.md.snap @@ -0,0 +1,40 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-518.md +--- +# Input + +```md +[ + ] + +[ + ]: /uri + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,4 +1,5 @@ + [ +-] ++ ] + +-[ ]: /uri ++[ ++ ]: /uri +``` + +# Output + +```md +[ + ] + +[ + ]: /uri +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-52.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-52.md.snap new file mode 100644 index 000000000000..7c76cb228de0 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-52.md.snap @@ -0,0 +1,51 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-52.md +--- +# Input + +```md + Foo +--- + + Foo +----- + + Foo + === + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,6 +1,8 @@ +-## Foo ++ Foo ++--- + +-## Foo ++ Foo ++----- + +-Foo +-=== ++ Foo ++ === +``` + +# Output + +```md + Foo +--- + + Foo +----- + + Foo + === +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-522.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-522.md.snap new file mode 100644 index 000000000000..d22c9c00be9d --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-522.md.snap @@ -0,0 +1,36 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-522.md +--- +# Input + +```md +[foo] +[] + +[foo]: /url "title" + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,4 +1,4 @@ +-[foo] ++[foo] + [] + + [foo]: /url "title" +``` + +# Output + +```md +[foo] +[] + +[foo]: /url "title" +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-53.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-53.md.snap new file mode 100644 index 000000000000..dc6fdd629e2f --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-53.md.snap @@ -0,0 +1,38 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-53.md +--- +# Input + +```md + Foo + --- + + Foo +--- + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -2,5 +2,4 @@ + --- + + Foo +- + --- +``` + +# Output + +```md + Foo + --- + + Foo +--- +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-530.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-530.md.snap new file mode 100644 index 000000000000..04c1df6499f1 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-530.md.snap @@ -0,0 +1,33 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-530.md +--- +# Input + +```md +[foo*]: /url + +*[foo*] + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ + [foo*]: /url + +-_[foo_] ++*[foo*] +``` + +# Output + +```md +[foo*]: /url + +*[foo*] +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-54.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-54.md.snap new file mode 100644 index 000000000000..414d6c6eddc1 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-54.md.snap @@ -0,0 +1,31 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-54.md +--- +# Input + +```md +Foo + ---- + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,2 @@ + Foo +- +---- ++ ---- +``` + +# Output + +```md +Foo + ---- +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-542.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-542.md.snap new file mode 100644 index 000000000000..98956e5e2bdb --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-542.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-542.md +--- +# Input + +```md +My ![foo bar](/path/to/train.jpg "title" ) + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1 @@ +-My ![foo bar](/path/to/train.jpg "title") ++My ![foo bar](/path/to/train.jpg "title" ) +``` + +# Output + +```md +My ![foo bar](/path/to/train.jpg "title" ) +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-543.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-543.md.snap new file mode 100644 index 000000000000..5750269aa6e8 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-543.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-543.md +--- +# Input + +```md +![foo]() + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1 @@ +-![foo](url) ++![foo]() +``` + +# Output + +```md +![foo]() +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-55.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-55.md.snap new file mode 100644 index 000000000000..a89a2996150b --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-55.md.snap @@ -0,0 +1,30 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-55.md +--- +# Input + +```md +Foo + --- + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,2 +1,2 @@ + Foo +---- ++ --- +``` + +# Output + +```md +Foo + --- +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-550.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-550.md.snap new file mode 100644 index 000000000000..fabeb4919828 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-550.md.snap @@ -0,0 +1,36 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-550.md +--- +# Input + +```md +![foo] +[] + +[foo]: /url "title" + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,4 +1,4 @@ +-![foo] ++![foo] + [] + + [foo]: /url "title" +``` + +# Output + +```md +![foo] +[] + +[foo]: /url "title" +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-56.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-56.md.snap new file mode 100644 index 000000000000..ca23e8d71a4e --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-56.md.snap @@ -0,0 +1,39 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-56.md +--- +# Input + +```md +Foo += = + +Foo +--- - + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -2,5 +2,4 @@ + = = + + Foo +- +---- ++--- - +``` + +# Output + +```md +Foo += = + +Foo +--- - +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-57.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-57.md.snap new file mode 100644 index 000000000000..c1b1c2797b70 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-57.md.snap @@ -0,0 +1,30 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-57.md +--- +# Input + +```md +Foo +----- + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1,2 @@ +-## Foo ++Foo ++----- +``` + +# Output + +```md +Foo +----- +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-58.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-58.md.snap new file mode 100644 index 000000000000..6c31925b2c66 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-58.md.snap @@ -0,0 +1,30 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-58.md +--- +# Input + +```md +Foo\ +---- + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1,2 @@ +-## Foo\ ++Foo\ ++---- +``` + +# Output + +```md +Foo\ +---- +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-581.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-581.md.snap new file mode 100644 index 000000000000..23a16e6e63a0 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-581.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-581.md +--- +# Input + +```md +<33> <__> + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1 @@ +-<33> <\_\_> ++<33> <__> +``` + +# Output + +```md +<33> <__> +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-582.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-582.md.snap new file mode 100644 index 000000000000..61112ecc14f2 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-582.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-582.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-59.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-59.md.snap new file mode 100644 index 000000000000..53dbc8c2b1fc --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-59.md.snap @@ -0,0 +1,48 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-59.md +--- +# Input + +```md +`Foo +---- +` + + + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,7 +1,7 @@ +-## `Foo +- ++`Foo ++---- + ` + +-## +``` + +# Output + +```md +`Foo +---- +` + + +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-599.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-599.md.snap new file mode 100644 index 000000000000..45ceabb7f546 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-599.md.snap @@ -0,0 +1,30 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-599.md +--- +# Input + +```md +foo +baz + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,2 +1,2 @@ +-foo ++foo + baz +``` + +# Output + +```md +foo +baz +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-6.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-6.md.snap new file mode 100644 index 000000000000..130a393848c8 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-6.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-6.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-60.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-60.md.snap new file mode 100644 index 000000000000..d27cf30d167d --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-60.md.snap @@ -0,0 +1,30 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-60.md +--- +# Input + +```md +> Foo +--- + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,2 @@ + > Foo +- + --- +``` + +# Output + +```md +> Foo +--- +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-600.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-600.md.snap new file mode 100644 index 000000000000..876c50170116 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-600.md.snap @@ -0,0 +1,30 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-600.md +--- +# Input + +```md +foo + bar + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,2 +1,2 @@ + foo +- bar ++ bar +``` + +# Output + +```md +foo + bar +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-601.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-601.md.snap new file mode 100644 index 000000000000..f5ae3afb91cf --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-601.md.snap @@ -0,0 +1,30 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-601.md +--- +# Input + +```md +foo\ + bar + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,2 +1,2 @@ + foo\ +- bar ++ bar +``` + +# Output + +```md +foo\ + bar +``` 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 new file mode 100644 index 000000000000..7a5c9328ab0e --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-602.md.snap @@ -0,0 +1,31 @@ +--- +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 new file mode 100644 index 000000000000..576884fae657 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-603.md.snap @@ -0,0 +1,31 @@ +--- +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-609.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-609.md.snap new file mode 100644 index 000000000000..c8f36ae14b48 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-609.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-609.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-61.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-61.md.snap new file mode 100644 index 000000000000..f9135266263b --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-61.md.snap @@ -0,0 +1,34 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-61.md +--- +# Input + +```md +> foo +bar +=== + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ + > foo +- +-# bar ++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 new file mode 100644 index 000000000000..9c8a11a0a55e --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-611.md.snap @@ -0,0 +1,27 @@ +--- +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 +``` + +# Output + +```md +### foo +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-613.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-613.md.snap new file mode 100644 index 000000000000..9cc00b83e9cc --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-613.md.snap @@ -0,0 +1,31 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-613.md +--- +# Input + +```md +foo + baz + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,2 +1,2 @@ +-foo +-baz ++foo ++ baz +``` + +# Output + +```md +foo + baz +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-616.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-616.md.snap new file mode 100644 index 000000000000..a1b1acd5a81c --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-616.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-616.md +--- +# Input + +```md +Multiple spaces + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1 @@ +-Multiple spaces ++Multiple spaces +``` + +# Output + +```md +Multiple spaces +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-62.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-62.md.snap new file mode 100644 index 000000000000..11d39a8256ff --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-62.md.snap @@ -0,0 +1,30 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-62.md +--- +# Input + +```md +- Foo +--- + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,2 @@ + - Foo +- + --- +``` + +# Output + +```md +- Foo +--- +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-63.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-63.md.snap new file mode 100644 index 000000000000..3a3073c97563 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-63.md.snap @@ -0,0 +1,33 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-63.md +--- +# Input + +```md +Foo +Bar +--- + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,4 +1,3 @@ + Foo + Bar +- + --- +``` + +# Output + +```md +Foo +Bar +--- +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-64.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-64.md.snap new file mode 100644 index 000000000000..1424e9e02fea --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-64.md.snap @@ -0,0 +1,44 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-64.md +--- +# Input + +```md +--- +Foo +--- +Bar +--- +Baz + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,7 +1,6 @@ + --- + Foo + --- +- +-## Bar +- ++Bar ++--- + Baz +``` + +# Output + +```md +--- +Foo +--- +Bar +--- +Baz +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-65.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-65.md.snap new file mode 100644 index 000000000000..6058b7fa0320 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-65.md.snap @@ -0,0 +1,29 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-65.md +--- +# Input + +```md + +==== + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1,2 @@ ++ + ==== +``` + +# Output + +```md + +==== +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-67.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-67.md.snap new file mode 100644 index 000000000000..37a6a41f257d --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-67.md.snap @@ -0,0 +1,31 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-67.md +--- +# Input + +```md +- foo +----- + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,2 @@ + - foo +- +---- ++----- +``` + +# Output + +```md +- foo +----- +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-68.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-68.md.snap new file mode 100644 index 000000000000..5e8d20115ce9 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-68.md.snap @@ -0,0 +1,30 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-68.md +--- +# Input + +```md + foo +--- + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,2 @@ + foo +- + --- +``` + +# Output + +```md + foo +--- +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-69.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-69.md.snap new file mode 100644 index 000000000000..752ad5dffc90 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-69.md.snap @@ -0,0 +1,31 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-69.md +--- +# Input + +```md +> foo +----- + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,2 @@ + > foo +- +---- ++----- +``` + +# Output + +```md +> foo +----- +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-7.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-7.md.snap new file mode 100644 index 000000000000..b8527780d291 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-7.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-7.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-70.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-70.md.snap new file mode 100644 index 000000000000..a673948346b4 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-70.md.snap @@ -0,0 +1,30 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-70.md +--- +# Input + +```md +\> foo +------ + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1,2 @@ +-## \> foo ++\> foo ++------ +``` + +# Output + +```md +\> foo +------ +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-71.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-71.md.snap new file mode 100644 index 000000000000..2103b4e76662 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-71.md.snap @@ -0,0 +1,40 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-71.md +--- +# Input + +```md +Foo + +bar +--- +baz + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,5 +1,5 @@ + Foo + +-## bar +- ++bar ++--- + baz +``` + +# Output + +```md +Foo + +bar +--- +baz +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-73.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-73.md.snap new file mode 100644 index 000000000000..7519770d809a --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-73.md.snap @@ -0,0 +1,38 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-73.md +--- +# Input + +```md +Foo +bar +* * * +baz + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,6 +1,4 @@ + Foo + bar +- +---- +- ++* * * + baz +``` + +# Output + +```md +Foo +bar +* * * +baz +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-76.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-76.md.snap new file mode 100644 index 000000000000..98a8a6843b64 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-76.md.snap @@ -0,0 +1,34 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-76.md +--- +# Input + +```md + - foo + + bar + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ +-- foo ++ - foo + +- bar ++ bar +``` + +# Output + +```md + - foo + + bar +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-77.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-77.md.snap new file mode 100644 index 000000000000..570cd204ddea --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-77.md.snap @@ -0,0 +1,32 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-77.md +--- +# Input + +```md +1. foo + + - bar + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,2 +1,3 @@ + 1. foo ++ + - bar +``` + +# Output + +```md +1. foo + + - bar +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-79.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-79.md.snap new file mode 100644 index 000000000000..11c3c98fa696 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-79.md.snap @@ -0,0 +1,47 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-79.md +--- +# Input + +```md + chunk1 + + chunk2 + + + + chunk3 + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,7 +1,7 @@ + chunk1 + + chunk2 +- +- +- ++ ++ ++ + chunk3 +``` + +# Output + +```md + chunk1 + + chunk2 + + + + chunk3 +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-8.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-8.md.snap new file mode 100644 index 000000000000..de72830581f1 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-8.md.snap @@ -0,0 +1,30 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-8.md +--- +# Input + +```md + foo + bar + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,2 +1,2 @@ + foo +- bar ++ bar +``` + +# Output + +```md + foo + bar +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-80.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-80.md.snap new file mode 100644 index 000000000000..27f170edc68e --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-80.md.snap @@ -0,0 +1,33 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-80.md +--- +# Input + +```md + chunk1 + + chunk2 + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ + chunk1 +- ++ + chunk2 +``` + +# Output + +```md + chunk1 + + chunk2 +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-81.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-81.md.snap new file mode 100644 index 000000000000..39c12526cbb7 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-81.md.snap @@ -0,0 +1,30 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-81.md +--- +# Input + +```md +Foo + bar + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,2 +1,2 @@ + Foo +-bar ++ bar +``` + +# Output + +```md +Foo + bar +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-82.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-82.md.snap new file mode 100644 index 000000000000..92eaeb1dbc48 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-82.md.snap @@ -0,0 +1,30 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-82.md +--- +# Input + +```md + foo +bar + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,2 @@ + foo +- + bar +``` + +# Output + +```md + foo +bar +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-83.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-83.md.snap new file mode 100644 index 000000000000..8052824353cc --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-83.md.snap @@ -0,0 +1,47 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-83.md +--- +# Input + +```md +# Heading + foo +Heading +------ + foo +---- + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,9 +1,6 @@ + # Heading +- + foo +- +-## Heading +- ++Heading ++------ + foo +- +---- ++---- +``` + +# Output + +```md +# Heading + foo +Heading +------ + foo +---- +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-85.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-85.md.snap new file mode 100644 index 000000000000..6975a8ffe162 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-85.md.snap @@ -0,0 +1,35 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-85.md +--- +# Input + +```md + + + foo + + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1,4 @@ ++ ++ + foo ++ +``` + +# Output + +```md + + + foo + +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-86.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-86.md.snap new file mode 100644 index 000000000000..554309b8dbc1 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-86.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-86.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-88.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-88.md.snap new file mode 100644 index 000000000000..a9400495dcd6 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-88.md.snap @@ -0,0 +1,37 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-88.md +--- +# Input + +```md +~~~ +< + > +~~~ + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,4 +1,4 @@ +-``` ++~~~ + < + > +-``` ++~~~ +``` + +# Output + +```md +~~~ +< + > +~~~ +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-9.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-9.md.snap new file mode 100644 index 000000000000..0b358359a62e --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-9.md.snap @@ -0,0 +1,35 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-9.md +--- +# Input + +```md + - foo + - bar + - baz + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ +-- foo +- - bar +- - baz ++ - foo ++ - bar ++ - baz +``` + +# Output + +```md + - foo + - bar + - baz +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-90.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-90.md.snap new file mode 100644 index 000000000000..0c3180346670 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-90.md.snap @@ -0,0 +1,37 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-90.md +--- +# Input + +```md +~~~ +aaa +``` +~~~ + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,4 +1,4 @@ +-```` ++~~~ + aaa + ``` +-```` ++~~~ +``` + +# Output + +```md +~~~ +aaa +``` +~~~ +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-91.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-91.md.snap new file mode 100644 index 000000000000..d860591b67a4 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-91.md.snap @@ -0,0 +1,36 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-91.md +--- +# Input + +```md +```` +aaa +``` +`````` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,4 +1,4 @@ + ```` + aaa + ``` +-```` ++`````` +``` + +# Output + +```md +```` +aaa +``` +`````` +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-92.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-92.md.snap new file mode 100644 index 000000000000..160745bb1b0c --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-92.md.snap @@ -0,0 +1,37 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-92.md +--- +# Input + +```md +~~~~ +aaa +~~~ +~~~~ + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,4 +1,4 @@ +-``` ++~~~~ + aaa + ~~~ +-``` ++~~~~ +``` + +# Output + +```md +~~~~ +aaa +~~~ +~~~~ +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-93.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-93.md.snap new file mode 100644 index 000000000000..ac069d6e8d89 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-93.md.snap @@ -0,0 +1,49 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-93.md +--- +# Input + +```md +``` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1 @@ + ``` +- +-``` +``` + +# Output + +```md +``` +``` + +# Errors +``` +example-93.md:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Unterminated fenced code block, expected closing triple backticks (```). + + > 1 │ ``` + │ ^^^ + 2 │ + + i code block started here + + > 1 │ ``` + │ ^^^ + 2 │ + + i Add closing triple backticks (```) at the start of a new line. + + +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-94.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-94.md.snap new file mode 100644 index 000000000000..1e30f49ed7a5 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-94.md.snap @@ -0,0 +1,60 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-94.md +--- +# Input + +```md +````` + +``` +aaa + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,5 +1,4 @@ +-```` ++````` + + ``` + aaa +-```` +``` + +# Output + +```md +````` + +``` +aaa +``` + +# Errors +``` +example-94.md:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Unterminated fenced code block, expected closing triple backticks (```). + + > 1 │ ````` + │ ^^^^^ + 2 │ + 3 │ ``` + + i code block started here + + > 1 │ ````` + │ ^^^^^ + 2 │ + 3 │ ``` + + i Add closing triple backticks (```) at the start of a new line. + + +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-95.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-95.md.snap new file mode 100644 index 000000000000..bfbd8399d2bb --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-95.md.snap @@ -0,0 +1,59 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-95.md +--- +# Input + +```md +> ``` +> aaa + +bbb + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,5 +1,4 @@ + > ``` + > aaa +-> ``` + + bbb +``` + +# Output + +```md +> ``` +> aaa + +bbb +``` + +# Errors +``` +example-95.md:1:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Unterminated fenced code block, expected closing triple backticks (```). + + > 1 │ > ``` + │ ^^^ + 2 │ > aaa + 3 │ + + i code block started here + + > 1 │ > ``` + │ ^^^ + 2 │ > aaa + 3 │ + + i Add closing triple backticks (```) at the start of a new line. + + +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-96.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-96.md.snap new file mode 100644 index 000000000000..163970581e06 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-96.md.snap @@ -0,0 +1,36 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-96.md +--- +# Input + +```md +``` + + +``` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,4 +1,4 @@ + ``` + +- ++ + ``` +``` + +# Output + +```md +``` + + +``` +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-97.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-97.md.snap new file mode 100644 index 000000000000..3e6db9a57d15 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-97.md.snap @@ -0,0 +1,30 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-97.md +--- +# Input + +```md +``` +``` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,2 @@ + ``` +- + ``` +``` + +# Output + +```md +``` +``` +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-98.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-98.md.snap new file mode 100644 index 000000000000..c26beca7629e --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-98.md.snap @@ -0,0 +1,37 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-98.md +--- +# Input + +```md + ``` + aaa +aaa +``` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,4 +1,4 @@ +-``` +-aaa ++ ``` ++ aaa + aaa + ``` +``` + +# Output + +```md + ``` + aaa +aaa +``` +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-99.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-99.md.snap new file mode 100644 index 000000000000..b230891de1e7 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/spec/example-99.md.snap @@ -0,0 +1,41 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/spec/example-99.md +--- +# Input + +```md + ``` +aaa + aaa +aaa + ``` + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,5 +1,5 @@ +-``` ++ ``` + aaa ++ aaa + aaa +-aaa +-``` ++ ``` +``` + +# Output + +```md + ``` +aaa + aaa +aaa + ``` +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/splitCjkText/symbolSpaceNewLine.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/splitCjkText/symbolSpaceNewLine.md.snap new file mode 100644 index 000000000000..89a0b2cda66a --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/splitCjkText/symbolSpaceNewLine.md.snap @@ -0,0 +1,181 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/splitCjkText/symbolSpaceNewLine.md +--- +# Input + +```md +日本語 +、 +にほんご +。 +汉语, +中文. +日 +本 +語 +, +に +ほ +ん +ご +. +English +words!? +漢字 +! +汉字 +? +「セリフ」 +(括弧) +文字 +(括弧) +文字 +【括弧】 +日本語 +English + +「禁則(きんそく)処理(しょり)!」 +「禁則(きんそく)処理(しょり)!」 +「禁則(きんそく)処理(しょり)!」 +「禁則(きんそく)処理(しょり)」 +「禁則(きんそく)処理(しょり)!」 +「禁則(きんそく)処理(しょり)!」 +「禁則(きんそく)処理(しょり)」 +「禁則(きんそく)処理(しょり)」 +「禁則(きんそく)処理(しょり)!!!!」 +「禁則(きんそく)処理(しょり)!!!」 +「禁則(きんそく)処理(しょり)!」 +「禁則(きんそく)処理(しょり)!」 +「禁則(きんそく)処理(しょり)!」 +「禁則(きんそく)処理(しょり)!」 +「禁則(きんそく)処理(しょり)!」 +「禁則(きんそく)処理(しょり)!」 + +中点 +・ +中点 + +禁則処理にわざと違反した文章のテストを今から行います。準備はいいでしょうか?レデ +ィ、ゴー! + +[ウ +ィキペディア] + +[ウ +ィキペディア]: https://ja.wikipedia.org/ + +C言 +語 +・ +C++ +・ +Go +・ +Rust + +U+301C〜 +U+FF5E~ +U+1F221🈡 + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -55,7 +55,8 @@ + [ウ + ィキペディア] + +-[ウ ィキペディア]: https://ja.wikipedia.org/ ++[ウ ++ィキペディア]: https://ja.wikipedia.org/ + + C言 + 語 +``` + +# Output + +```md +日本語 +、 +にほんご +。 +汉语, +中文. +日 +本 +語 +, +に +ほ +ん +ご +. +English +words!? +漢字 +! +汉字 +? +「セリフ」 +(括弧) +文字 +(括弧) +文字 +【括弧】 +日本語 +English + +「禁則(きんそく)処理(しょり)!」 +「禁則(きんそく)処理(しょり)!」 +「禁則(きんそく)処理(しょり)!」 +「禁則(きんそく)処理(しょり)」 +「禁則(きんそく)処理(しょり)!」 +「禁則(きんそく)処理(しょり)!」 +「禁則(きんそく)処理(しょり)」 +「禁則(きんそく)処理(しょり)」 +「禁則(きんそく)処理(しょり)!!!!」 +「禁則(きんそく)処理(しょり)!!!」 +「禁則(きんそく)処理(しょり)!」 +「禁則(きんそく)処理(しょり)!」 +「禁則(きんそく)処理(しょり)!」 +「禁則(きんそく)処理(しょり)!」 +「禁則(きんそく)処理(しょり)!」 +「禁則(きんそく)処理(しょり)!」 + +中点 +・ +中点 + +禁則処理にわざと違反した文章のテストを今から行います。準備はいいでしょうか?レデ +ィ、ゴー! + +[ウ +ィキペディア] + +[ウ +ィキペディア]: https://ja.wikipedia.org/ + +C言 +語 +・ +C++ +・ +Go +・ +Rust + +U+301C〜 +U+FF5E~ +U+1F221🈡 +``` + +# Lines exceeding max width of 80 characters +``` + 52: 禁則処理にわざと違反した文章のテストを今から行います。準備はいいでしょうか?レデ +``` 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 new file mode 100644 index 000000000000..2d85c0b59c1a --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/strong/underscore.md.snap @@ -0,0 +1,27 @@ +--- +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/table/align.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/table/align.md.snap new file mode 100644 index 000000000000..1f6d7313b308 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/table/align.md.snap @@ -0,0 +1,35 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/table/align.md +--- +# Input + +```md +|a|b|c| +|:--|:-:|--:| +|d|e|f| + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ +-| a | b | c | +-| :-- | :-: | --: | +-| d | e | f | ++|a|b|c| ++|:--|:-:|--:| ++|d|e|f| +``` + +# Output + +```md +|a|b|c| +|:--|:-:|--:| +|d|e|f| +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/table/cjk.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/table/cjk.md.snap new file mode 100644 index 000000000000..b1c6c300cdde --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/table/cjk.md.snap @@ -0,0 +1,34 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/table/cjk.md +--- +# Input + +```md +| abc | def | ghi | +| --- | --- | --- | +| 第一欄 | 第二欄 | 第三欄 | + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ +-| abc | def | ghi | +-| ------ | ------ | ------ | ++| abc | def | ghi | ++| --- | --- | --- | + | 第一欄 | 第二欄 | 第三欄 | +``` + +# Output + +```md +| abc | def | ghi | +| --- | --- | --- | +| 第一欄 | 第二欄 | 第三欄 | +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/table/emoji.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/table/emoji.md.snap new file mode 100644 index 000000000000..51200e82e91a --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/table/emoji.md.snap @@ -0,0 +1,34 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/table/emoji.md +--- +# Input + +```md +| abc | def | ghi | +| --- | --- | --- | +| 👍👍👍 | 👍👍👍 | 👍👍👍 | + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ +-| abc | def | ghi | +-| ------ | ------ | ------ | ++| abc | def | ghi | ++| --- | --- | --- | + | 👍👍👍 | 👍👍👍 | 👍👍👍 | +``` + +# Output + +```md +| abc | def | ghi | +| --- | --- | --- | +| 👍👍👍 | 👍👍👍 | 👍👍👍 | +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/table/empty-table/empty-table.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/table/empty-table/empty-table.md.snap new file mode 100644 index 000000000000..3e13082eaeb7 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/table/empty-table/empty-table.md.snap @@ -0,0 +1,64 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/table/empty-table/empty-table.md +--- +# Input + +```md +Text + +| Specify the selected option : | Option 1 | +|:--| --- | + +Text + +| Should print as compact table when --proseWrap=never|a long long long long long long long long long long long long long head| +|---|--:| + +Text + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,11 +1,11 @@ + Text + + | Specify the selected option : | Option 1 | +-| :---------------------------- | -------- | ++|:--| --- | + + Text + +-| Should print as compact table when --proseWrap=never | a long long long long long long long long long long long long long head | +-| ---------------------------------------------------- | ----------------------------------------------------------------------: | ++| Should print as compact table when --proseWrap=never|a long long long long long long long long long long long long long head| ++|---|--:| + + Text +``` + +# Output + +```md +Text + +| Specify the selected option : | Option 1 | +|:--| --- | + +Text + +| Should print as compact table when --proseWrap=never|a long long long long long long long long long long long long long head| +|---|--:| + +Text +``` + +# Lines exceeding max width of 80 characters +``` + 8: | Should print as compact table when --proseWrap=never|a long long long long long long long long long long long long long head| +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/table/empty.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/table/empty.md.snap new file mode 100644 index 000000000000..8802736acf01 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/table/empty.md.snap @@ -0,0 +1,39 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/table/empty.md +--- +# Input + +```md +Foo | Bar +--- | --- +X | +Y | + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,4 +1,4 @@ +-| Foo | Bar | +-| --- | --- | +-| X | +-| Y | ++Foo | Bar ++--- | --- ++X | ++Y | +``` + +# Output + +```md +Foo | Bar +--- | --- +X | +Y | +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/table/escape.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/table/escape.md.snap new file mode 100644 index 000000000000..cfc57803c1c7 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/table/escape.md.snap @@ -0,0 +1,35 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/table/escape.md +--- +# Input + +```md +| a | b | c | +|:--|:-:|--:| +| \| | \| | \| | + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ +-| a | b | c | +-| :-- | :-: | --: | +-| \| | \| | \| | ++| a | b | c | ++|:--|:-:|--:| ++| \| | \| | \| | +``` + +# Output + +```md +| a | b | c | +|:--|:-:|--:| +| \| | \| | \| | +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/table/html.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/table/html.md.snap new file mode 100644 index 000000000000..dd289c2ff465 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/table/html.md.snap @@ -0,0 +1,40 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/table/html.md +--- +# Input + +```md +Default | CLI Override | API Override +--------|--------------|------------- +`"none"` | --trailing-comma | trailingComma: "" + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ +-| Default | CLI Override | API Override | +-| -------- | ------------------------------------------------------ | ------------------------------------------------------ | +-| `"none"` | --trailing-comma | trailingComma: "" | ++Default | CLI Override | API Override ++--------|--------------|------------- ++`"none"` | --trailing-comma | trailingComma: "" +``` + +# Output + +```md +Default | CLI Override | API Override +--------|--------------|------------- +`"none"` | --trailing-comma | trailingComma: "" +``` + +# Lines exceeding max width of 80 characters +``` + 3: `"none"` | --trailing-comma | trailingComma: "" +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/table/issue-15572.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/table/issue-15572.md.snap new file mode 100644 index 000000000000..e38a64ce693b --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/table/issue-15572.md.snap @@ -0,0 +1,37 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/table/issue-15572.md +--- +# Input + +```md +| | | +| :-: | :-: | +| ✔ | ✘ | +| ✘ | ✔ | +| ✔ | ✘ | +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -2,4 +2,4 @@ + | :-: | :-: | + | ✔ | ✘ | + | ✘ | ✔ | +-| ✔ | ✘ | ++| ✔ | ✘ | +\ No newline at end of file +``` + +# Output + +```md +| | | +| :-: | :-: | +| ✔ | ✘ | +| ✘ | ✔ | +| ✔ | ✘ |``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/table/simple.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/table/simple.md.snap new file mode 100644 index 000000000000..5a681c78a020 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/table/simple.md.snap @@ -0,0 +1,34 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/table/simple.md +--- +# Input + +```md +| Title A | Title B | Title C | +|---|---|---| +| content A | content B | content C | + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,3 @@ +-| Title A | Title B | Title C | +-| --------- | --------- | --------- | ++| Title A | Title B | Title C | ++|---|---|---| + | content A | content B | content C | +``` + +# Output + +```md +| Title A | Title B | Title C | +|---|---|---| +| content A | content B | content C | +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/table/table.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/table/table.md.snap new file mode 100644 index 000000000000..e005f37527ae --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/table/table.md.snap @@ -0,0 +1,90 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/table/table.md +--- +# Input + +```md +- min-table + + | Age | Time | Food | Gold | Requirement | + | ------------ | ----- | ---- | ---- | ----------------------- | + | Feudal Age | 02:10 | 500 | 0 | Dark Age building x 2 | + | Castle Age | 02:40 | 800 | 200 |- | + | Imperial Age | 03:30 | 1000 | 800 | Castle Age building x 2 | +- big-table + + |学号|姓名|分数| + |-|-|-| + |小明|男|75| + |小红|女|79| + |小陆|男|92| + +| col1 | col2 | col3 | +|---|--|--| +| long text | `` | text | + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,19 +1,18 @@ + - min-table + +- | Age | Time | Food | Gold | Requirement | ++ | Age | Time | Food | Gold | Requirement | + | ------------ | ----- | ---- | ---- | ----------------------- | +- | Feudal Age | 02:10 | 500 | 0 | Dark Age building x 2 | +- | Castle Age | 02:40 | 800 | 200 | - | +- | Imperial Age | 03:30 | 1000 | 800 | Castle Age building x 2 | +- ++ | Feudal Age | 02:10 | 500 | 0 | Dark Age building x 2 | ++ | Castle Age | 02:40 | 800 | 200 |- | ++ | Imperial Age | 03:30 | 1000 | 800 | Castle Age building x 2 | + - big-table + +- | 学号 | 姓名 | 分数 | +- | ---- | ---- | ---- | +- | 小明 | 男 | 75 | +- | 小红 | 女 | 79 | +- | 小陆 | 男 | 92 | ++ |学号|姓名|分数| ++ |-|-|-| ++ |小明|男|75| ++ |小红|女|79| ++ |小陆|男|92| + +-| col1 | col2 | col3 | +-| --------- | ---- | ---- | +-| long text | `` | text | ++| col1 | col2 | col3 | ++|---|--|--| ++| long text | `` | text | +``` + +# Output + +```md +- min-table + + | Age | Time | Food | Gold | Requirement | + | ------------ | ----- | ---- | ---- | ----------------------- | + | Feudal Age | 02:10 | 500 | 0 | Dark Age building x 2 | + | Castle Age | 02:40 | 800 | 200 |- | + | Imperial Age | 03:30 | 1000 | 800 | Castle Age building x 2 | +- big-table + + |学号|姓名|分数| + |-|-|-| + |小明|男|75| + |小红|女|79| + |小陆|男|92| + +| col1 | col2 | col3 | +|---|--|--| +| long text | `` | text | +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/thematicBreak/list.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/thematicBreak/list.md.snap new file mode 100644 index 000000000000..f3cb9fc30bc1 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/thematicBreak/list.md.snap @@ -0,0 +1,32 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/thematicBreak/list.md +--- +# Input + +```md +- * * * ++ - - - + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,3 +1,2 @@ +-- *** +- +-* --- ++- * * * +++ - - - +``` + +# Output + +```md +- * * * ++ - - - +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/thematicBreak/simple.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/thematicBreak/simple.md.snap new file mode 100644 index 000000000000..14c5e08cb1eb --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/thematicBreak/simple.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/thematicBreak/simple.md +--- +# Input + +```md +*** + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1 @@ +---- ++*** +``` + +# Output + +```md +*** +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/wiki-link/extra-brackets-leading.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/wiki-link/extra-brackets-leading.md.snap new file mode 100644 index 000000000000..a81761efc4c9 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/wiki-link/extra-brackets-leading.md.snap @@ -0,0 +1,34 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/wiki-link/extra-brackets-leading.md +--- +# Input + +```md +A very long line of markdown with additional brackets as it wraps over [[[the end like this]]. + + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1,2 @@ + A very long line of markdown with additional brackets as it wraps over [[[the end like this]]. ++ +``` + +# Output + +```md +A very long line of markdown with additional brackets as it wraps over [[[the end like this]]. + +``` + +# Lines exceeding max width of 80 characters +``` + 1: A very long line of markdown with additional brackets as it wraps over [[[the end like this]]. +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/wiki-link/extra-brackets-trailing.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/wiki-link/extra-brackets-trailing.md.snap new file mode 100644 index 000000000000..0a46e0f88fdd --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/wiki-link/extra-brackets-trailing.md.snap @@ -0,0 +1,34 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/wiki-link/extra-brackets-trailing.md +--- +# Input + +```md +A very long line of markdown with additional brackets as it wraps over [[the end like this]]]. + + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1,2 @@ + A very long line of markdown with additional brackets as it wraps over [[the end like this]]]. ++ +``` + +# Output + +```md +A very long line of markdown with additional brackets as it wraps over [[the end like this]]]. + +``` + +# Lines exceeding max width of 80 characters +``` + 1: A very long line of markdown with additional brackets as it wraps over [[the end like this]]]. +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/wiki-link/extra-brackets.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/wiki-link/extra-brackets.md.snap new file mode 100644 index 000000000000..8eac2cea2cbf --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/wiki-link/extra-brackets.md.snap @@ -0,0 +1,34 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/wiki-link/extra-brackets.md +--- +# Input + +```md +A very long line of markdown with additional brackets as it wraps over the [[[end like this]]]. + + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1,2 @@ + A very long line of markdown with additional brackets as it wraps over the [[[end like this]]]. ++ +``` + +# Output + +```md +A very long line of markdown with additional brackets as it wraps over the [[[end like this]]]. + +``` + +# Lines exceeding max width of 80 characters +``` + 1: A very long line of markdown with additional brackets as it wraps over the [[[end like this]]]. +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/wiki-link/with-whitespace.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/wiki-link/with-whitespace.md.snap new file mode 100644 index 000000000000..0269bab6f49a --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/wiki-link/with-whitespace.md.snap @@ -0,0 +1,27 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/wiki-link/with-whitespace.md +--- +# Input + +```md +[[ Here is a link with leading and trailing whitespace. ]] + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1 +1 @@ +-[[Here is a link with leading and trailing whitespace.]] ++[[ Here is a link with leading and trailing whitespace. ]] +``` + +# Output + +```md +[[ Here is a link with leading and trailing whitespace. ]] +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/markdown/word/escape.md.snap b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/word/escape.md.snap new file mode 100644 index 000000000000..3d462cef53c6 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/word/escape.md.snap @@ -0,0 +1,95 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/word/escape.md +--- +# Input + +```md +hello \* world _ ~~ ya + +escape & html < entity > foo + +qweqwe \\ \ \1 123123 + +asd & asd „ 123 + +123_123_123 + +456 _ 456 _ 456 + +123*123*123 + +123 * 123 * 123 + +## 类的 prototype 属性和\_\_proto\_\_属性 + +123�123 + +123#123 + +123Ϡ123 + +123😉123 + +123"123 + +123�123 + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,4 +1,4 @@ +-hello \* world \_ ~~ ya ++hello \* world _ ~~ ya + + escape & html < entity > foo + +@@ -12,7 +12,7 @@ + + 123*123*123 + +-123 _ 123 _ 123 ++123 * 123 * 123 + + ## 类的 prototype 属性和\_\_proto\_\_属性 + +``` + +# Output + +```md +hello \* world _ ~~ ya + +escape & html < entity > foo + +qweqwe \\ \ \1 123123 + +asd & asd „ 123 + +123_123_123 + +456 _ 456 _ 456 + +123*123*123 + +123 * 123 * 123 + +## 类的 prototype 属性和\_\_proto\_\_属性 + +123�123 + +123#123 + +123Ϡ123 + +123😉123 + +123"123 + +123�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 new file mode 100644 index 000000000000..12e8d9f1f0e5 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/markdown/yaml/trailing-spaces.md.snap @@ -0,0 +1,46 @@ +--- +source: crates/biome_formatter_test/src/snapshot_builder.rs +info: markdown/yaml/trailing-spaces.md +--- +# Input + +```md +--- + v spaces +--- + +This paragraph should be considered part of the _markdown_ instead of *yaml*. + +--- + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Biome +@@ -1,7 +1,7 @@ + --- + 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*. + + --- +``` + +# Output + +```md +--- + v spaces +--- + +This paragraph should be considered part of the _markdown_ instead of *yaml*. + +--- +``` diff --git a/crates/biome_markdown_formatter/tests/specs/prettier/prepare_tests.js b/crates/biome_markdown_formatter/tests/specs/prettier/prepare_tests.js new file mode 100644 index 000000000000..b5aa004bd567 --- /dev/null +++ b/crates/biome_markdown_formatter/tests/specs/prettier/prepare_tests.js @@ -0,0 +1,148 @@ +const { promises: fs } = require('fs'); +const path = require('path'); +const prettier = require("prettier"); + +if (process.argv.length < 3) { + console.error('Usage: node prepare_tests.js '); + process.exit(2); +} + +const defaultConfig = { + trailingComma: 'all', + tabWidth: 2, + printWidth: 80, + singleQuote: false, + jsxSingleQuote: false, + useTabs: false, + embeddedLanguageFormatting: 'off' +}; + +const PRETTIER_ROOT = path.resolve(process.argv[2], 'tests/format'); + +async function extractPrettierTests(type, config) { + const root = path.resolve(PRETTIER_ROOT, type); + console.log('Extracting tests from %s ...', root); + await traverseDir(root, config); +} + +// Recursively traverse the test directory to search for snapshots files +async function traverseDir(dir, input_config) { + const config = { + ...input_config, + ...defaultConfig + }; + + for (const entry of await fs.readdir(dir, { withFileTypes: true })) { + if (entry.isDirectory()) { + await traverseDir(path.resolve(dir, entry.name), config); + continue; + } + + if (entry.isFile()) { + const file = entry.name; + + // Ignore spec files + if (file.startsWith('format.test')) { + continue; + } + + // Compute a relative path from the Prettier root directory + // to this file, then an absolute path using the biome_js_formatter + // specs directory as a root instead + const filePath = path.resolve(dir, file); + const relPath = path.relative(PRETTIER_ROOT, filePath); + const outPath = path.resolve(process.cwd(), relPath); + const snapshotPath = path.resolve( + dir, + '__snapshots__', + 'format.test.js.snap' + ); + const snapFile = path.basename(file) + '.prettier-snap'; + const snapOriginalFile = path.basename(file) + '.prettier-snap-original'; + + const snapshot = require(snapshotPath); + + const key = `${file} format 1`; + + if (key in snapshot) { + let snapshotContent = String(snapshot[key]); + + // Copy the snapshot input file, ensuring the + // parent directory exists + const outDir = path.resolve(outPath, '..'); + await fs.mkdir(outDir, { recursive: true }); + await fs.copyFile(filePath, outPath); + // Extract the expected output from the snapshot text + const INPUT = + "=====================================input======================================"; + const OUTPUT = + '=====================================output====================================='; + const OPTIONS = + "====================================options====================================="; + const FOOTER = + '================================================================================'; + + // extract options string + const optionsStart = snapshotContent.match(new RegExp(OPTIONS + '\\n')); + const optionsEnd = snapshotContent.match(new RegExp('\\n' + INPUT)); + const optionsStartOffset = optionsStart.index + optionsStart[0].length; + const optionsEndOffset = optionsEnd.index; + const optionsContent = snapshotContent.substring(optionsStartOffset, optionsEndOffset); + + // if range options are not defined, use default value + // https://prettier.io/docs/en/options#range + const rangeOptions = { + rangeStart: Number(optionsContent.match(new RegExp(/rangeStart: (\d+)/))?.[1] ?? 0), + rangeEnd: Number(optionsContent.match(new RegExp(/rangeEnd: (\d+)/))?.[1] ?? Infinity) + }; + + // extract output string + const outputStart = snapshotContent.match(new RegExp(OUTPUT + '\\n')); + const outputEnd = snapshotContent.match(new RegExp('\\n' + FOOTER)); + + const outputStartOffset = outputStart.index + outputStart[0].length; + const outputEndOffset = outputEnd.index; + snapshotContent = snapshotContent.substring(outputStartOffset, outputEndOffset); + + let originalSnapshot = snapshotContent; + try { + // We need to reformat prettier snapshot + // because Biome and Prettier have different default options + const updatedOptions = { ...rangeOptions, ...config }; + snapshotContent = await prettier.format(snapshotContent, updatedOptions); + } catch (error) { + console.error(`Prettier format error in ${filePath}: ${error}`); + } + + if (originalSnapshot !== snapshotContent) { + // Prettier has a reformat issue + await fs.writeFile(path.resolve(outDir, snapOriginalFile), originalSnapshot); + } + + // Write the expected output to an additional prettier-snap + // file in the specs directory + await fs.writeFile(path.resolve(outDir, snapFile), snapshotContent); + } else { + // Load content from the current file + const content = await fs.readFile(filePath, { encoding: 'utf8' }); + + try { + // Try to format input with prettier + const prettierOutput = await prettier.format(content, config); + + const outDir = path.resolve(outPath, '..'); + await fs.mkdir(outDir, { recursive: true }); + await fs.copyFile(filePath, outPath); + + // Write the expected output to an additional prettier-snap + // file in the specs directory + await fs.writeFile(path.resolve(outDir, snapFile), prettierOutput); + } catch (error) { + console.error(`Prettier format error in ${filePath}: ${error}`); + } + } + } + } +} + +module.exports = { extractPrettierTests }; diff --git a/crates/biome_markdown_parser/src/lib.rs b/crates/biome_markdown_parser/src/lib.rs index c4a825e017c0..58e362c208db 100644 --- a/crates/biome_markdown_parser/src/lib.rs +++ b/crates/biome_markdown_parser/src/lib.rs @@ -2,7 +2,7 @@ use biome_markdown_factory::MarkdownSyntaxFactory; use biome_markdown_syntax::{MarkdownLanguage, MarkdownSyntaxNode, MdDocument}; -use biome_parser::{prelude::ParseDiagnostic, tree_sink::LosslessTreeSink}; +use biome_parser::{AnyParse, NodeParse, prelude::ParseDiagnostic, tree_sink::LosslessTreeSink}; use biome_rowan::{AstNode, NodeCache}; use parser::MarkdownParser; use syntax::parse_document; @@ -130,3 +130,11 @@ impl MarkdownParse { MdDocument::unwrap_cast(self.syntax()) } } + +impl From for AnyParse { + fn from(parse: MarkdownParse) -> Self { + let root = parse.syntax(); + let diagnostics = parse.into_diagnostics(); + NodeParse::new(root.as_send().unwrap(), diagnostics).into() + } +} diff --git a/crates/biome_markdown_syntax/src/lib.rs b/crates/biome_markdown_syntax/src/lib.rs index 579b74c052a0..388c48d0f71b 100644 --- a/crates/biome_markdown_syntax/src/lib.rs +++ b/crates/biome_markdown_syntax/src/lib.rs @@ -6,10 +6,10 @@ mod generated; mod syntax_node; pub use file_source::MdFileSource; +pub use syntax_node::*; pub use self::generated::*; use biome_rowan::{RawSyntaxKind, SyntaxKind, TriviaPieceKind}; -pub use syntax_node::*; impl From for MarkdownSyntaxKind { fn from(d: u16) -> Self { diff --git a/crates/biome_service/Cargo.toml b/crates/biome_service/Cargo.toml index 2ee86c23f34f..dc03ea8ed321 100644 --- a/crates/biome_service/Cargo.toml +++ b/crates/biome_service/Cargo.toml @@ -14,74 +14,76 @@ publish = false # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -biome_analyze = { workspace = true, features = ["serde"] } -biome_configuration = { workspace = true } -biome_console = { workspace = true } -biome_css_analyze = { workspace = true } -biome_css_formatter = { workspace = true } -biome_css_parser = { workspace = true } -biome_css_semantic = { workspace = true } -biome_css_syntax = { workspace = true } -biome_deserialize = { workspace = true } -biome_diagnostics = { workspace = true, features = ["camino"] } -biome_formatter = { workspace = true, features = ["serde"] } -biome_fs = { workspace = true, features = ["serde"] } -biome_glob = { workspace = true } -biome_graphql_analyze = { workspace = true } -biome_graphql_formatter = { workspace = true } -biome_graphql_parser = { workspace = true } -biome_graphql_syntax = { workspace = true } -biome_grit_formatter = { workspace = true } -biome_grit_parser = { workspace = true } -biome_grit_patterns = { workspace = true, features = ["serde"] } -biome_grit_syntax = { workspace = true } -biome_html_analyze = { workspace = true } -biome_html_factory = { workspace = true } -biome_html_formatter = { workspace = true, features = ["serde"] } -biome_html_parser = { workspace = true } -biome_html_syntax = { workspace = true } -biome_js_analyze = { workspace = true } -biome_js_factory = { workspace = true } -biome_js_formatter = { workspace = true, features = ["serde"] } -biome_js_parser = { workspace = true } -biome_js_semantic = { workspace = true } -biome_js_syntax = { workspace = true } -biome_js_type_info = { workspace = true } -biome_json_analyze = { workspace = true } -biome_json_formatter = { workspace = true, features = ["serde"] } -biome_json_parser = { workspace = true } -biome_json_syntax = { workspace = true } -biome_markdown_parser = { workspace = true } -biome_markdown_syntax = { workspace = true } -biome_module_graph = { workspace = true, features = ["serde"] } -biome_package = { workspace = true } -biome_parser = { workspace = true } -biome_plugin_loader = { workspace = true } -biome_project_layout = { workspace = true } -biome_resolver = { workspace = true } -biome_rowan = { workspace = true, features = ["serde"] } -biome_string_case = { workspace = true } -biome_text_edit = { workspace = true } -boxcar = { workspace = true } -bpaf = { workspace = true } -camino = { workspace = true } -crossbeam = { workspace = true } -either = { workspace = true } -enumflags2 = { workspace = true, features = ["serde"] } -getrandom = { workspace = true, features = ["js"] } -ignore = { workspace = true } -notify = { version = "8.2.0", features = ["crossbeam-channel"] } -papaya = { workspace = true } -rayon = { workspace = true } -regex = { workspace = true } -rustc-hash = { workspace = true } -schemars = { workspace = true, optional = true } -serde = { workspace = true, features = ["derive"] } -serde_json = { workspace = true, features = ["raw_value"] } -smallvec = { workspace = true, features = ["serde"] } -tokio = { workspace = true, features = ["sync"] } -tracing = { workspace = true, features = ["attributes", "log"] } -web-time = { workspace = true } +biome_analyze = { workspace = true, features = ["serde"] } +biome_configuration = { workspace = true } +biome_console = { workspace = true } +biome_css_analyze = { workspace = true } +biome_css_formatter = { workspace = true } +biome_css_parser = { workspace = true } +biome_css_semantic = { workspace = true } +biome_css_syntax = { workspace = true } +biome_deserialize = { workspace = true } +biome_diagnostics = { workspace = true, features = ["camino"] } +biome_formatter = { workspace = true, features = ["serde"] } +biome_fs = { workspace = true, features = ["serde"] } +biome_glob = { workspace = true } +biome_graphql_analyze = { workspace = true } +biome_graphql_formatter = { workspace = true } +biome_graphql_parser = { workspace = true } +biome_graphql_syntax = { workspace = true } +biome_grit_formatter = { workspace = true } +biome_grit_parser = { workspace = true } +biome_grit_patterns = { workspace = true, features = ["serde"] } +biome_grit_syntax = { workspace = true } +biome_html_analyze = { workspace = true } +biome_html_factory = { workspace = true } +biome_html_formatter = { workspace = true, features = ["serde"] } +biome_html_parser = { workspace = true } +biome_html_syntax = { workspace = true } +biome_js_analyze = { workspace = true } +biome_js_factory = { workspace = true } +biome_js_formatter = { workspace = true, features = ["serde"] } +biome_js_parser = { workspace = true } +biome_js_semantic = { workspace = true } +biome_js_syntax = { workspace = true } +biome_js_type_info = { workspace = true } +biome_json_analyze = { workspace = true } +biome_json_formatter = { workspace = true, features = ["serde"] } +biome_json_parser = { workspace = true } +biome_json_syntax = { workspace = true } +biome_markdown_factory = { workspace = true } +biome_markdown_formatter = { workspace = true } +biome_markdown_parser = { workspace = true } +biome_markdown_syntax = { workspace = true } +biome_module_graph = { workspace = true, features = ["serde"] } +biome_package = { workspace = true } +biome_parser = { workspace = true } +biome_plugin_loader = { workspace = true } +biome_project_layout = { workspace = true } +biome_resolver = { workspace = true } +biome_rowan = { workspace = true, features = ["serde"] } +biome_string_case = { workspace = true } +biome_text_edit = { workspace = true } +boxcar = { workspace = true } +bpaf = { workspace = true } +camino = { workspace = true } +crossbeam = { workspace = true } +either = { workspace = true } +enumflags2 = { workspace = true, features = ["serde"] } +getrandom = { workspace = true, features = ["js"] } +ignore = { workspace = true } +notify = { version = "8.2.0", features = ["crossbeam-channel"] } +papaya = { workspace = true } +rayon = { workspace = true } +regex = { workspace = true } +rustc-hash = { workspace = true } +schemars = { workspace = true, optional = true } +serde = { workspace = true, features = ["derive"] } +serde_json = { workspace = true, features = ["raw_value"] } +smallvec = { workspace = true, features = ["serde"] } +tokio = { workspace = true, features = ["sync"] } +tracing = { workspace = true, features = ["attributes", "log"] } +web-time = { workspace = true } [dev-dependencies] insta = { workspace = true } diff --git a/crates/biome_service/src/file_handlers/markdown.rs b/crates/biome_service/src/file_handlers/markdown.rs index 0924a2c196f4..46feb5b31f3a 100644 --- a/crates/biome_service/src/file_handlers/markdown.rs +++ b/crates/biome_service/src/file_handlers/markdown.rs @@ -11,10 +11,9 @@ use biome_analyze::AnalyzerOptions; use biome_configuration::analyzer::assist::AssistEnabled; use biome_configuration::analyzer::linter::LinterEnabled; use biome_configuration::formatter::FormatterEnabled; -use biome_formatter::{ - IndentStyle, IndentWidth, LineEnding, LineWidth, SimpleFormatOptions, TrailingNewline, -}; +use biome_formatter::{IndentStyle, IndentWidth, LineEnding, LineWidth, TrailingNewline}; use biome_fs::BiomePath; +use biome_markdown_formatter::context::MarkdownFormatOptions; use biome_markdown_parser::{MarkdownParseOptions, parse_markdown_with_cache}; use biome_markdown_syntax::{MarkdownLanguage, MarkdownSyntaxNode, MdDocument}; use biome_parser::{AnyParse, NodeParse}; @@ -48,7 +47,7 @@ impl ServiceLanguage for MarkdownLanguage { type FormatterSettings = MarkdownFormatterSettings; type LinterSettings = MarkdownLinterSettings; type AssistSettings = MarkdownAssistSettings; - type FormatOptions = SimpleFormatOptions; + type FormatOptions = MarkdownFormatOptions; type ParserSettings = (); type ParserOptions = MarkdownParseOptions; type EnvironmentSettings = (); @@ -100,13 +99,12 @@ impl ServiceLanguage for MarkdownLanguage { .trailing_newline .or(global.trailing_newline) .unwrap_or_default(); - SimpleFormatOptions { - indent_style, - indent_width, - line_width, - line_ending, - trailing_newline, - } + MarkdownFormatOptions::new() + .with_indent_style(indent_style) + .with_indent_width(indent_width) + .with_line_width(line_width) + .with_line_ending(line_ending) + .with_trailing_newline(trailing_newline) } fn resolve_analyzer_options(