"MD029 - Ordered list item prefix" when list includes code blocks in fences
See original GitHub issueThe below code throws https://github.com/DavidAnson/markdownlint/blob/v0.10.0/doc/Rules.md#md029 on the last line.
## Test
1. Run this script:
``` batch
cls
```
2. Start Task Manager
Markdown rendering works fine though, as the second item is indeed numbered “2”:
Test
- Run this script:
cls
- Start Task Manager
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Markdownlint Rules - kiki
MD029 - Ordered list item prefix ... This rule is triggered for ordered lists that do not either start with '1.' or do...
Read more >Markdown Style Guide - pimentaCHAT Documentation
MD029 - Ordered list item prefix. Ordered lists should be ordered by a prefix that increases in numerical order. Wrong: 1. Do this....
Read more >Markdownlint - Visual Studio Marketplace
Extension for Visual Studio Code - Markdown linting and style checking for Visual Studio ... MD029 ol-prefix - Ordered list item prefix ......
Read more >helm-chart/.markdownlint.yaml at main - Gitea
MD007/ul-indent - Unordered list indentation ... Include code blocks. code_blocks: true ... MD029/ol-prefix - Ordered list item prefix. MD029: # List style.
Read more >doc/Rules.md · Gitee 极速下载/markdownlint - Gitee.com
... MD029 - Ordered list item prefix; MD030 - Spaces after list markers; MD031 - Fenced code blocks should be surrounded by blank...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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):
@ChristianStadelmann That example does not produce MD046: https://dlaa.me/markdownlint/#%25m%23 Test 1. Run this script%3A ``` batch cls ``` 1. Start Task Manager 1. Fin
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.