[GH-ISSUE #429] New line doesnt restart list index, triggers MD029 #2206

Closed
opened 2026-03-07 20:05:32 +03:00 by kerem · 6 comments
Owner

Originally created by @wolf99 on GitHub (Sep 15, 2021).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/429

Using the following triggers MD029

1. first list, first item
2. first list, second item

1. second list, first item - MD029/ol-prefix: Ordered list item prefix [Expected: 3; Actual: 1; Style: 1/2/3] markdownlint (MD029)
2. second list, second item - MD029/ol-prefix: Ordered list item prefix [Expected: 4; Actual: 2; Style: 1/2/3] markdownlint (MD029)

Seems like markdownlint incorrectly continues index counting across the newline.
That is, it does not allow the new line between the lists to start a new list as far as the list index numbers are concerned.

Markdownlint v0.43.2 in MS VS Ccode 1.60.1 (seen on 1.60.0 also) on MS Windows 10 1909

Originally created by @wolf99 on GitHub (Sep 15, 2021). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/429 Using the following triggers MD029 ```markdown 1. first list, first item 2. first list, second item 1. second list, first item - MD029/ol-prefix: Ordered list item prefix [Expected: 3; Actual: 1; Style: 1/2/3] markdownlint (MD029) 2. second list, second item - MD029/ol-prefix: Ordered list item prefix [Expected: 4; Actual: 2; Style: 1/2/3] markdownlint (MD029) ``` Seems like markdownlint incorrectly continues index counting across the newline. That is, it does not allow the new line between the lists to start a new list as far as the list index numbers are concerned. Markdownlint v0.43.2 in MS VS Ccode 1.60.1 (seen on 1.60.0 also) on MS Windows 10 1909
kerem 2026-03-07 20:05:32 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner
<!-- gh-comment-id:920221258 --> @DavidAnson commented on GitHub (Sep 15, 2021): The output is correct - this is a single list: https://markdown-it.github.io/#md3=%7B%22source%22%3A%221.%20first%20list%2C%20first%20item%5Cn2.%20first%20list%2C%20second%20item%5Cn%5Cn1.%20second%20list%2C%20first%20item%5Cn2.%20second%20list%2C%20second%20item%22%2C%22defaults%22%3A%7B%22html%22%3Afalse%2C%22xhtmlOut%22%3Afalse%2C%22breaks%22%3Afalse%2C%22langPrefix%22%3A%22language-%22%2C%22linkify%22%3Atrue%2C%22typographer%22%3Atrue%2C%22_highlight%22%3Atrue%2C%22_strict%22%3Afalse%2C%22_view%22%3A%22src%22%7D%7D The specification calls out that blank lines are allowed between list items and do not "split" the list: https://spec.commonmark.org/0.30/#lists
Author
Owner

@wolf99 commented on GitHub (Sep 15, 2021):

Oh.
I agree the spec does indicate that.
However, do you know is there then a recommended way to have two separate ordered lists, one after the other ?

<!-- gh-comment-id:920361782 --> @wolf99 commented on GitHub (Sep 15, 2021): Oh. I agree the spec does indicate that. However, do you know is there then a recommended way to have two separate ordered lists, one after the other ?
Author
Owner

@DavidAnson commented on GitHub (Sep 15, 2021):

Example 308 suggests an empty HTML comment: https://spec.commonmark.org/0.30/#example-308

<!-- gh-comment-id:920365030 --> @DavidAnson commented on GitHub (Sep 15, 2021): Example 308 suggests an empty HTML comment: https://spec.commonmark.org/0.30/#example-308
Author
Owner

@wolf99 commented on GitHub (Sep 16, 2021):

Yuck.
But it works 😅

<!-- gh-comment-id:920707537 --> @wolf99 commented on GitHub (Sep 16, 2021): Yuck. But it works 😅
Author
Owner

@wolf99 commented on GitHub (Sep 16, 2021):

Doesn't this breach MD033?
https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md#md033---inline-html

<!-- gh-comment-id:921013570 --> @wolf99 commented on GitHub (Sep 16, 2021): Doesn't this breach MD033? https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md#md033---inline-html
Author
Owner

@DavidAnson commented on GitHub (Sep 16, 2021):

No, comments are not elements and example 308 does not trigger any violations: https://dlaa.me/markdownlint/#%25m%23%20Example%20308%0A%0A-%20foo%0A-%20bar%0A%0A%3C!--%20--%3E%0A%0A-%20baz%0A-%20bim%0A

<!-- gh-comment-id:921029795 --> @DavidAnson commented on GitHub (Sep 16, 2021): No, comments are not elements and example 308 does not trigger any violations: https://dlaa.me/markdownlint/#%25m%23%20Example%20308%0A%0A-%20foo%0A-%20bar%0A%0A%3C!--%20--%3E%0A%0A-%20baz%0A-%20bim%0A
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/markdownlint#2206
No description provided.