diff --git a/doc/Prettier.md b/doc/Prettier.md new file mode 100644 index 000000000..5221995ed --- /dev/null +++ b/doc/Prettier.md @@ -0,0 +1,23 @@ +# Using markdownlint with Prettier + +[`Prettier`](https://prettier.io) is a popular code formatter. For the most part, +it works seamlessly with `markdownlint`. Special situations are documented +below. + +## List item indentation + +The default settings of `markdownlint` and `Prettier` are compatible and don't +result in any linting violations. If `Prettier` is used with `--tab-width` set +to `4`, the following `markdownlint` configuration can be used: + +```json +{ + "MD007": { + "indent": 4 + }, + "MD030": { + "ul_single": 3, + "ul_multi": 3 + } +} +``` diff --git a/doc/Rules.md b/doc/Rules.md index 1cc8d5fbb..7ca6afb8c 100644 --- a/doc/Rules.md +++ b/doc/Rules.md @@ -329,6 +329,8 @@ issue for multi-markdown parsers, which require 4-space indents. More informatio and . +Note: See [Prettier.md](Prettier.md) for compatibility information. + ## MD009 - Trailing spaces @@ -1183,6 +1185,8 @@ for your selected document style. Rationale: Violations of this rule can lead to improperly rendered content. +Note: See [Prettier.md](Prettier.md) for compatibility information. + ## MD031 - Fenced code blocks should be surrounded by blank lines diff --git a/test/markdownlint-test.js b/test/markdownlint-test.js index 7813a722a..b39566739 100644 --- a/test/markdownlint-test.js +++ b/test/markdownlint-test.js @@ -80,6 +80,7 @@ test.cb("projectFilesNoInlineConfig", (t) => { "README.md", "CONTRIBUTING.md", "doc/CustomRules.md", + "doc/Prettier.md", "helpers/README.md" ], "noInlineConfig": true, @@ -94,6 +95,7 @@ test.cb("projectFilesNoInlineConfig", (t) => { "README.md": [], "CONTRIBUTING.md": [], "doc/CustomRules.md": [], + "doc/Prettier.md": [], "helpers/README.md": [] }; t.deepEqual(actual, expected, "Issue(s) with project files.");