MD list items inside HTML lists


#1

Markdown does not have explicit markup, but combines adjacent list items into a common, implicitly defined list. HTML, on the other hand, does have <ul>, <ol> and more to hold <li>s.

Commonmark allows literal HTML blocks to contain Markdown if some provisions (blank lines etc.) are followed.

Should a Markdown list item inside an HTML list generate a nested list or should it become a direct child? Dingus

Variant 1: direct child

Authors may find this useful if they wanted to apply attributes to the whole list, e.g. type=a.

<ul>

- foo
</ul>
.
<ul>
<li>foo</li>
</ul>

Variant 2: naively nested

This is what the reference implementations currently do.

<ul>

- foo
</ul>
.
<ul>
<ul>
<li>foo</li>
</ul>
</ul>

Variant 3: properly nested

<ul>

- foo
</ul>
.
<ul>
<li>
<ul>
<li>foo</li>
</ul>
</li>
</ul>

#2

It goes without saying this would require the Markdown parser to understand HTML, and could be complex (e.g. <ul></ul> on one line would need to not trigger this state, nor more complicated inline HTML or HTML blocks with similar patterns).