question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"MD029 - Ordered list item prefix" when list includes code blocks in fences

See original GitHub issue

The 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

  1. Run this script:
cls
  1. Start Task Manager

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

13reactions
DavidAnsoncommented, 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:

## Test

1. Run this script:

  ``` batch
  cls
  ```

1. Start Task Manager
1. Fin

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):

## Test

1. Run this script:

   ``` batch
   cls
   ```

1. Start Task Manager
1. Fin
2reactions
DavidAnsoncommented, Jan 19, 2021

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found