markdig icon indicating copy to clipboard operation
markdig copied to clipboard

A list with empty lines extends into the next paragraph.

Open snnz opened this issue 11 months ago • 1 comments

Noticed this while looking at the test samples in #839.

CommonMark spec states that a list item can begin with at most one blank line. Example 280 demonstrates this.

var result = Markdown.ToHtml("-\n\n  foo");

The result is:

<ul>
<li></li>
</ul>
<p>foo</p>

If one more empty item is added

var result = Markdown.ToHtml("-\n-\n\n  foo");

Everything is as expected again:

<ul>
<li></li>
<li></li>
</ul>
<p>foo</p>

But if a blank line is inserted between the items:

var result = Markdown.ToHtml("-\n\n-\n\n  foo");

The result is suddenly

<ul>
<li></li>
<li><p>foo</p></li>
</ul>

Isn't this strange?

snnz avatar Jan 03 '25 05:01 snnz

Repro here

Isn't this strange?

Yes, it's probably a bug.

xoofx avatar Feb 02 '25 14:02 xoofx

This one presumably got fixed by #888 with the 0.42.0 release.

MihaZupan avatar Oct 20 '25 20:10 MihaZupan