New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: Suggest MD030 configuration when Prettier is detected (ex: tab width) #410
Comments
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 |
Under the hood, Prettier uses Remark for the formatting. I like some of the remark-lint rules, but their formatter is poor. |
I agree so, and I am complained about Prettier's style and policy (does not append extra options in principle).
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"?
|
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. |
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. |
In addition to that, it would be good if I can confirm whether markdown can suggest changing settings when the length of spaces is |
Good idea, I'll use this issue to track that. |
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? |
Not everything has to be. I say just that, if everything is easier to implement, everything is better. |
prettier/prettier#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:
May markdownlint disable or suggest disabling MD030 when Prettier is detected and tabwidth = 4 is used.
The text was updated successfully, but these errors were encountered: