-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Closed
Labels
L2 - annoyingSimilar to L1 - broken but there is a known workaround available for the issueSimilar to L1 - broken but there is a known workaround available for the issuecategory: lists
Description
Describe the bug
👋Hello. I am using marked and it is a great library, thank you for creating it.
According to this discussion, V4.2.3 is supposed to be 100% compliant with the "Lists" and "List items" of the CommonMark standard. However, it seems to have some issues with parsing lists that contain line breaks, such as the following:
1.
Monday
2.
Tuesday
3.
Wednesday
To Reproduce
Steps to reproduce the behavior:
- Marked Demo
(3 list items) - CommonMark Demo
(an empty list item and a<p>)
Expected behavior
I believe that parsing it in the following way, like in CommonMark, is correct:
<ol>
<li></li>
</ol>
<p>Monday
2.
Tuesday
3.
Wednesday</p>
Explanation
According to CommonMark 5.2 List items:
- A list may start or end with an empty list item. So
1.is a list item with empty content. - In this case, the width
Wof the list marker (1.) is2, so in order forMondayto become the content of1., it needs to have3(=W + 1) or more spaces of indentation. In the given example, since there are0spaces,Mondayshould become regular text (<p>).
Example1:
1.
Monday
Expected result:
<ol>
<li></li>
</ol>
<p>Monday</p>
Example2:
1.
Monday
Expected result:
<ol>
<li>Monday</li>
</ol>
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
L2 - annoyingSimilar to L1 - broken but there is a known workaround available for the issueSimilar to L1 - broken but there is a known workaround available for the issuecategory: lists