mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2026-04-25 01:05:55 +03:00
[GH-ISSUE #141] MD007: default value of 2 vs. 4 spaces #119
Labels
No labels
bug
enhancement
enhancement
enhancement
fixed in next
fixed in next
fixed in next
new rule
new rule
new rule
pull-request
question
refactoring
refactoring
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/markdownlint#119
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @borekb on GitHub (Aug 11, 2018).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/141
Due to related discussions, e.g., https://github.com/careteditor/issues/issues/782 or https://github.com/neilsustc/vscode-markdown/issues/241, I wanted to ask about the history of MD007 rule. After a brief research, it seems to me that:
The rule description even mentions the tradeoffs but I still find it a bit strange that aesthetics would be chosen over functionality. The question I wanted to ask is whether you'd make the same choice today. I personally don't mind the default too much, the main thing for me is that it is customizable (which I always do), I just wanted to learn more about the context as it seems that markdownlint is used as one of the arguments for 2-spaced nested lists in the discussions mentioned above.
Thanks!
@DavidAnson commented on GitHub (Aug 11, 2018):
In no particular order:
I didn't realize this was such a controversial issue until you pointed it out!
MD007 is one of the core rules I inherited from the Ruby implementation when I created this one using Node. I had an explicit goal at the time to match behavior as closely as possible, so what's in place today is heavily derived from someone else's decision.
That said, I typically agree with Mark's original direction and probably would have implemented this rule the same on my own!
I agree that two spaces look nicer and considering that the primary goal of Markdown was to create a format that looks nice and is easy to read, this is significant.
Following your comparison link, it appears to me that 30 parsers treat 2 spaces as a nested unordered list and just 3 do not. Switching to 4 spaces changes that to 32 and 1, but that is not much different and it is still not universal agreement.
Gruber's documentation does not appear to cover the topic of nested lists, but the Dingus creates a nested unordered list from a 2 space indent.
I am not very concerned about what happens for lists of more than 100 items, and I'm not looking to convince people that my way is better.
What I'd like is for MD007 to easily allow 3- and 4-space documents for people who prefer that. As you note, that is already possible today through configuration, but it would be nice if the rule could be a little smarter by default. I will use this issue to look into adding that in a future release.
@borekb commented on GitHub (Aug 12, 2018):
Thank you for the explanation!
@DavidAnson commented on GitHub (Mar 8, 2019):
I've thought about this and don't have a good way to support 2- and 4-space-people without changing the default parameter value or asking one of them to customize. 2-people won't want to allow 4-space behavior and 4-people won't want 2-space behavior, so trying to detect from the file doesn't seem good enough for this rule. Because of that, I'm going to leave things alone for now. Thanks for raising the issue, though!
@Ark-kun commented on GitHub (Nov 4, 2025):
@DavidAnson User feedback: The markdownlint's auto-formatter just broke our MKDocs-based website. Python's Markdown library requires 4 spaces for the 2nd level of list, but markdownlint has auto-formatted it to 2 spaces, breaking the rendering.
Is there any way to configure this?
@DavidAnson commented on GitHub (Nov 4, 2025):
MD007 is configurable: https://github.com/DavidAnson/markdownlint/blob/main/doc/md007.md