mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2026-04-25 09:16:02 +03:00
[GH-ISSUE #1345] MD029/ol-prefix: an extra space is needed for code fences in lists with more than 10 elements #669
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#669
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 @zachliu on GitHub (Sep 3, 2024).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/1345
I created a list with more than 10 entries. All of them have a code block in it.
See example:
I discovered that I had to use
4spaces instead of3(mentioned in https://github.com/DavidAnson/markdownlint/issues/38 and https://github.com/DavidAnson/markdownlint/issues/125) for code fences if their index number is >= 10 otherwise I getMD029/ol-prefix Ordered list item prefix [Expected: 1; Actual: 11; Style: 1/2/3]on items 11, 12, ... etc (interestingly not on item 10).@DavidAnson commented on GitHub (Sep 3, 2024):
Your example above produces no warnings from markdownlint as-is. The code fences in list items 10 and above need four spaces of indent because that's what corresponds to the first character after the previous list item marker. Specifically, "9. " is only three characters whereas "10. " is four, and thus the change. Per the CommonMark specification, using fewer spaces than required to nest the code fence within a list item causes the next list item marker to begin a new list. For example, insufficiently indenting the list in item 10 causes a warning for item 11 because it creates a new list that doesn't start with 1. So far as I can tell, everything here is correct and operating as intended.
@zachliu commented on GitHub (Sep 3, 2024):
sorry for the confusion. the example was provided so that it produced no warnings
had i not used 4 spaces for 10, 11, and 12, i would get the warnings
@zachliu commented on GitHub (Sep 3, 2024):
i see the point 👍
the number of spaces needs is the same as the indexes themselves:
9.needs three,10.needs four,100.needs five@DavidAnson commented on GitHub (Sep 4, 2024):
Right, without at least that many spaces, the code fence is not part of the list item as can be seen in this example where the middle fence has 3 instead of 4 spaces of indent: https://dlaa.me/markdownlint/#%25m%23%20Test%0A%0A9.%20...%3A%0A%0A%20%20%20%60%60%60bash%0A%20%20%20three%0A%20%20%20%60%60%60%0A%0A10.%20...%3A%0A%0A%20%20%20%60%60%60bash%0A%20%20%20three%0A%20%20%20%60%60%60%0A%0A11.%20...%3A%0A%0A%20%20%20%20%60%60%60bash%0A%20%20%20%20four%0A%20%20%20%20%60%60%60%0A