Redcarpet incorrectly parses nested lists
-
Lists: You can create a bulleted list by prefacing each line with a dash or an asterisk. For example:
- Item 1
- Item 2
- Item 3
( or equivalent string 5. Lists: You can create a bulleted list by prefacing each line with a dash or an asterisk. For example:\n\n * Item 1\n * Item 2\n * Item 3 )
Generates ...
"<ol>\n<li>Lists: You can create a bulleted list by prefacing each line with a dash or an asterisk. For example:</li>\n</ol>\n\n<ul>\n<li>Item 1</li>\n<li>Item 2</li>\n<li>Item 3</li>\n</ul>\n"
Any news on this? We are also having this problem with nested lists
The problem seems to be that the <li> tags that should wrap the nested <ul> or <ol> element are missing. Moreover, this problem affects HTML passed in, too, not just markdown. Rendering passed-in HTML gives a hint as to the nature of the problem, since it appears that
<ul>
<li>Item 1</li>
<li>
<ol>
<li>Subitem 1</li>
<li>Subitem 2</li>
<li>Subitem 3</li>
</ol>
</li>
</ul>
the rendered HTML will be look more like
<ul>
<li>Item 1</li>
<ol>
<li>Subitem 1</li>
<li>Subitem 2</li>
<li>Subitem 3</li>
</ol>
</ul>
which is invalid HTML.
Nope, sorry, the point in my last post about the surrounding <li> tags being stripped was mistaken! Passing in correctly nested <ul><li><ol></ol></li></ul> will retain the <li> tags.
Potentially related for those poking at code: https://github.com/vmg/redcarpet/blob/master/test/MarkdownTest_1.0.3/Tests/Ordered%20and%20unordered%20lists.html