[GH-ISSUE #410] Feature request: Suggest MD030 configuration when Prettier is detected (ex: tab width) #2190

Closed
opened 2026-03-07 20:05:24 +03:00 by kerem · 9 comments
Owner

Originally created by @tats-u on GitHub (Jul 3, 2021).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/410

https://github.com/prettier/prettier/issues/5019

Prettier, the most famous Markdown formatter, outputs "formatted" Markdown when tabwidth is not 2:

https://prettier.io/playground/#N4Igxg9gdgLgprEAuEBaABAMwhEAaECABxgEtoBnZUAQwCc6IB3ABXoSpRoBsmaBPKgQBGdGmADWcGAGUi40lADmyGHQCucAnAC2wuABMDhgDI1l6mkrgAxCHR00YZZchA11MXAQAWMHdwA6j6k8BTyYHAyHKGkAG6h-G5gFEIgihRwdDAsYkqOyJg8mQQAVhQAHgBCYpLSMjQ6cCaKcIXFWiDlFTKKStxwAIrqEPDt3CUg8nSZdG6OdBIGzFD4U3SKMIGkBjA+yAAcAAwERIyZgWJEbmdws3FtBACOI-C5xJzuFKhQcIaGazocBepCBuSsBSQRQmnUyOlIqg0sL6A2GozaUI6BBgNGE212+yQABZsWJSNw+gBhCA6SEgO4AVjW6kyABVcZxoZM4poAJJQYywGRgDYkACCApkMH4A3GmQAvvKgA

Input:

- foo

Output:

-   foo

This behavior makes sense when item is multi-lined like:

-   foo  
    bar  
    baz
-   qux  
    quux

May markdownlint disable or suggest disabling MD030 when Prettier is detected and tabwidth = 4 is used.

Originally created by @tats-u on GitHub (Jul 3, 2021). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/410 https://github.com/prettier/prettier/issues/5019 Prettier, the most famous Markdown formatter, outputs "formatted" Markdown when tabwidth is not 2: https://prettier.io/playground/#N4Igxg9gdgLgprEAuEBaABAMwhEAaECABxgEtoBnZUAQwCc6IB3ABXoSpRoBsmaBPKgQBGdGmADWcGAGUi40lADmyGHQCucAnAC2wuABMDhgDI1l6mkrgAxCHR00YZZchA11MXAQAWMHdwA6j6k8BTyYHAyHKGkAG6h-G5gFEIgihRwdDAsYkqOyJg8mQQAVhQAHgBCYpLSMjQ6cCaKcIXFWiDlFTKKStxwAIrqEPDt3CUg8nSZdG6OdBIGzFD4U3SKMIGkBjA+yAAcAAwERIyZgWJEbmdws3FtBACOI-C5xJzuFKhQcIaGazocBepCBuSsBSQRQmnUyOlIqg0sL6A2GozaUI6BBgNGE212+yQABZsWJSNw+gBhCA6SEgO4AVjW6kyABVcZxoZM4poAJJQYywGRgDYkACCApkMH4A3GmQAvvKgA Input: ```markdown - foo ``` Output: ```markdown - foo ``` This behavior makes sense when item is multi-lined like: ```markdown - foo bar baz - qux quux ``` May markdownlint disable or suggest disabling MD030 when Prettier is detected and tabwidth = 4 is used.
kerem 2026-03-07 20:05:24 +03:00
Author
Owner

@DavidAnson commented on GitHub (Jul 3, 2021):

I'm not sure I agree that:

-   foo  
    bar  
    baz
-   qux  
    quux

Makes more sense than:

- foo  
  bar  
  baz
- qux  
  quux

Both are allowed by the specification, though I think the latter is more common in practice.

Good news is this is already configurable via the parameters for MD030: https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md#md030---spaces-after-list-markers

I'm not sure how this library would determine that Prettier was going to be used or with what configuration?

Here's your example with no warnings: https://dlaa.me/markdownlint/#%25m%23%20Issue%20410%0A%0A-%20%20%20foo%20%20%0A%20%20%20%20bar%20%20%0A%20%20%20%20baz%0A-%20%20%20qux%20%20%0A%20%20%20%20quux%0A%0A%3C!--%20markdownlint-configure-file%20%7B%0A%20%20%22MD030%22%3A%20%7B%0A%20%20%20%20%22ul_multi%22%3A%203%0A%20%20%7D%0A%7D%20--%3E%0A

<!-- gh-comment-id:873345897 --> @DavidAnson commented on GitHub (Jul 3, 2021): I'm not sure I agree that: ```md - foo bar baz - qux quux ``` Makes more sense than: ```md - foo bar baz - qux quux ``` Both are allowed by the specification, though I think the latter is more common in practice. Good news is this is already configurable via the parameters for MD030: https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md#md030---spaces-after-list-markers I'm not sure how this library would determine that Prettier was going to be used or with what configuration? Here's your example with no warnings: https://dlaa.me/markdownlint/#%25m%23%20Issue%20410%0A%0A-%20%20%20foo%20%20%0A%20%20%20%20bar%20%20%0A%20%20%20%20baz%0A-%20%20%20qux%20%20%0A%20%20%20%20quux%0A%0A%3C!--%20markdownlint-configure-file%20%7B%0A%20%20%22MD030%22%3A%20%7B%0A%20%20%20%20%22ul_multi%22%3A%203%0A%20%20%7D%0A%7D%20--%3E%0A
Author
Owner

@nschonni commented on GitHub (Jul 3, 2021):

Under the hood, Prettier uses Remark for the formatting. I like some of the remark-lint rules, but their formatter is poor.

<!-- gh-comment-id:873400445 --> @nschonni commented on GitHub (Jul 3, 2021): Under the hood, Prettier uses Remark for the formatting. I like some of the remark-lint rules, but their formatter is poor.
Author
Owner

@tats-u commented on GitHub (Jul 4, 2021):

I think the latter is more common in practice.

I agree so, and I am complained about Prettier's style and policy (does not append extra options in principle).
HackMD adopts the - <item> style.

Good news is this is already configurable via the parameters for MD030: https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md#md030---spaces-after-list-markers

Thank you for the information. This is what I have wanted. Can I change the title to something like "Feature request: suggest https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md#md030---spaces-after-list-markers in MD030 when Prettier is detected"?

how this library would determine that Prettier was going to be used or with what configuration

  1. Examine packages.json
  2. Branch with if length of spaces between - (*) and a item is <tabwidth> - 1 (<tabwidth>); It may be useful that <tabwidth> is mostly one of (2,) 4, and 8
<!-- gh-comment-id:873560019 --> @tats-u commented on GitHub (Jul 4, 2021): > I think the latter is more common in practice. I agree so, and I am complained about Prettier's style and policy (does not append extra options in principle). [HackMD](https://hackmd.io/) adopts the `- <item>` style. > Good news is this is already configurable via the parameters for MD030: https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md#md030---spaces-after-list-markers Thank you for the information. This is what I have wanted. Can I change the title to something like "Feature request: suggest https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md#md030---spaces-after-list-markers in MD030 when Prettier is detected"? > how this library would determine that Prettier was going to be used or with what configuration 1. Examine `packages.json` 2. Branch with if length of spaces between `-` (`*`) and a item is `<tabwidth> - 1` (`<tabwidth>`); It may be useful that `<tabwidth>` is mostly one of (2,) 4, and 8
Author
Owner

@DavidAnson commented on GitHub (Jul 4, 2021):

As a library, this code does not sniff around the file system to guess what else might be installed. Here's the API it exposes for callers: https://github.com/DavidAnson/markdownlint#linting

We can discuss whether the CLI or the VS Code extension should look for the presence of other tools, but there are a number of ways Prettier might be configured, such as file, command-line, editor plugin, etc.. I'd rather not try to support the various ways that tool is configured.

In this case, there is a one-time configuration to match the list indent settings. I'd love for that to be even easier to find, but I'm not thinking that detecting Prettier is the best approach.

<!-- gh-comment-id:873632323 --> @DavidAnson commented on GitHub (Jul 4, 2021): As a library, this code does not sniff around the file system to guess what else might be installed. Here's the API it exposes for callers: https://github.com/DavidAnson/markdownlint#linting We can discuss whether the CLI or the VS Code extension should look for the presence of other tools, but there are a number of ways Prettier might be configured, such as file, command-line, editor plugin, etc.. I'd rather not try to support the various ways that tool is configured. In this case, there is a one-time configuration to match the list indent settings. I'd love for that to be even easier to find, but I'm not thinking that detecting Prettier is the best approach.
Author
Owner

@tats-u commented on GitHub (Jul 5, 2021):

You are right. How about adding tips for Prettier users in https://github.com/DavidAnson/markdownlint/blob/v0.23.1/doc/Rules.md#md030 and https://github.com/DavidAnson/markdownlint#configuration? This seems much easier.

<!-- gh-comment-id:873916008 --> @tats-u commented on GitHub (Jul 5, 2021): You are right. How about adding tips for Prettier users in https://github.com/DavidAnson/markdownlint/blob/v0.23.1/doc/Rules.md#md030 and https://github.com/DavidAnson/markdownlint#configuration? This seems much easier.
Author
Owner

@tats-u commented on GitHub (Jul 5, 2021):

In addition to that, it would be good if I can confirm whether markdown can suggest changing settings when the length of spaces is <tabwidth> - 1. (This has lower priority than tips for Prettier users)

<!-- gh-comment-id:873918852 --> @tats-u commented on GitHub (Jul 5, 2021): In addition to that, it would be good if I can confirm whether markdown can suggest changing settings when the length of spaces is `<tabwidth> - 1`. (This has lower priority than tips for Prettier users)
Author
Owner

@DavidAnson commented on GitHub (Jul 5, 2021):

You are right. How about adding tips for Prettier users in https://github.com/DavidAnson/markdownlint/blob/v0.23.1/doc/Rules.md#md030 and https://github.com/DavidAnson/markdownlint#configuration? This seems much easier.

Good idea, I'll use this issue to track that.

<!-- gh-comment-id:874281166 --> @DavidAnson commented on GitHub (Jul 5, 2021): > You are right. How about adding tips for Prettier users in https://github.com/DavidAnson/markdownlint/blob/v0.23.1/doc/Rules.md#md030 and https://github.com/DavidAnson/markdownlint#configuration? This seems much easier. Good idea, I'll use this issue to track that.
Author
Owner

@DavidAnson commented on GitHub (Jul 5, 2021):

In addition to that, it would be good if I can confirm whether markdown can suggest changing settings when the length of spaces is <tabwidth> - 1. (This has lower priority than tips for Prettier users)

I'm not sure I understand. Is the idea to detect if all the tabs are wrong in the same way and suggest a settings change?

<!-- gh-comment-id:874282814 --> @DavidAnson commented on GitHub (Jul 5, 2021): > In addition to that, it would be good if I can confirm whether markdown can suggest changing settings when the length of spaces is `<tabwidth> - 1`. (This has lower priority than tips for Prettier users) I'm not sure I understand. Is the idea to detect if all the tabs are wrong in the same way and suggest a settings change?
Author
Owner

@tats-u commented on GitHub (Jul 11, 2021):

Is the idea to detect if all the tabs are wrong in the same way and suggest a settings change?

Not everything has to be. I say just that, if everything is easier to implement, everything is better.

<!-- gh-comment-id:877777812 --> @tats-u commented on GitHub (Jul 11, 2021): > Is the idea to detect if all the tabs are wrong in the same way and suggest a settings change? Not everything has to be. I say just that, if everything is easier to implement, everything is better.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/markdownlint#2190
No description provided.