mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2026-04-25 17:26:22 +03:00
[GH-ISSUE #125] "MD029 - Ordered list item prefix" when list includes code blocks in fences #1953
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#1953
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 @jpluimers on GitHub (Jun 6, 2018).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/125
The below code throws https://github.com/DavidAnson/markdownlint/blob/v0.10.0/doc/Rules.md#md029 on the last line.
Markdown rendering works fine though, as the second item is indeed numbered "2":
Test
@DavidAnson commented on GitHub (Jun 6, 2018):
Your idea to test for same/new list was good, but thwarted by the fact some parsers allow list number continuation. :)
The following tweak to your example demonstrates that your scenario is actually two lists, not one, so the reported violation is correct:
The fix is to indent the code fence 3 spaces to line up with the start of first column of the list item above which tells the parser it is part of the item (not a separate block):
@DavidAnson commented on GitHub (Jun 6, 2018):
Here’s a link to the updated sample in the
markdown-itparser: sample@jpluimers commented on GitHub (Jun 6, 2018):
Thanks for teaching me this. I never noticed that markdown can start lists at non-1.
@ChristianStadelmann commented on GitHub (Jan 19, 2021):
@DavidAnson wrote:
Actually, this gives you the MD046 warning. Is this by intention? Is something wrong with this example?
@DavidAnson commented on GitHub (Jan 19, 2021):
@ChristianStadelmann That example does not produce MD046: https://dlaa.me/markdownlint/#%25m%23%20Test%0A%0A1.%20Run%20this%20script%3A%0A%0A%20%20%20%60%60%60%20batch%0A%20%20%20cls%0A%20%20%20%60%60%60%0A%0A1.%20Start%20Task%20Manager%0A1.%20Fin%0A
You might be seeing it in your document if you are using the default "consistent" style and have an indented code block earlier in the document - that indented code and the example's fenced code would not be consistent.
@ChristianStadelmann commented on GitHub (Jan 20, 2021):
Ok, thanks for explaining!
|char #2636