mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2026-04-25 09:16:02 +03:00
[GH-ISSUE #20] Unordered sublist in ordered list #15
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#15
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 @anglepoised on GitHub (May 25, 2016).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/20
I'm having trouble getting an unordered sublist in an ordered list to pass linting with the default config. I've tested in playground and with
markdownlint-cli.With 2 space indent I get MD006 and also see 3 distinct lists - ordered, unordered, ordered - in the playground preview:
With 4 (or 3, or 5 just for kicks) space indent I get MD007:
An unordered sublist with 2 space indent in an unordered parent works fine:
As does inverting the structure of what I'm trying to achieve: an ordered sublist with 2 space indent in an unordered parent:
I may be missing a spacing requirement in the CommonMark spec, but feels like either one of the first two examples should pass if the fourth does?
@DavidAnson commented on GitHub (May 25, 2016):
Thanks for reporting, this is really interesting!
Regarding the first example, please note that
markdown-it(the parser used bymarkdownlint) does not recognize this structure as a nested list: https://markdown-it.github.io/The reason is explained in the first few paragraphs of the spec: http://spec.commonmark.org/0.25/#list-items
Briefly, the indent of bar/baz must be 3 spaces in order to line up under the start of the content of the first item, foo, because "1. " is 3 characters long . Once that is done,
markdown-itrecognizes the structure correctly.Going back to
markdownlint, the problem is that MD007 is reported for both of your first examples. That's most likely because of this misunderstanding about indent length of unordered vs. ordered lists.I'll look into this more soon, thanks!
@DavidAnson commented on GitHub (Jun 26, 2016):
I've fixed the incorrect MD007 instances and documented the remaining MD006 behavior. Please see the updated documentation and new tests for details. Thanks!
@koppor commented on GitHub (Apr 29, 2020):
Does not seem to work currently:
When identing with four spaces, it works:
Environment
VS Code, markdownlint 0.35.1
@DavidAnson commented on GitHub (Apr 29, 2020):
CommonMark treats the first example like two lists at the same level (because the nesting of two spaces is insufficient to push it into the ordered list item), so the warning you see is correct: Example
The second example nests one more space than necessary, but is treated as a nested list: Example
The linter could probably warn for the second case, but that is beyond what this issue was opened for. From what I can tell, the initially reported behavior of correct syntax being incorrectly flagged seems to have been addressed. After reviewing the original discussion, if you’d like to open a new issue asking for a violation to be reported in the four-space case, that seems reasonable and I would look into it.