blackfriday icon indicating copy to clipboard operation
blackfriday copied to clipboard

List rendering

Open IanMadd opened this issue 5 years ago • 1 comments

I'm getting odd behavior in lists:

  • when adding an additional paragraph to a bulleted list item
  • when adding a nested list to a bulleted list

Adding Paragraph to a list item:

*   This is a list item with two paragraphs.

    This is the second paragraph in the list item. 

*   Another item in the same list.

Output:

<ul>
<li><p>This is a list item with two paragraphs.</p>

<p>This is the second paragraph in the list item.</p></li>

<li><p>Another item in the same list.</p></li>
</ul>
Screen Shot 2019-08-28 at 11 02 37 AM

I think the proper output is:

<ul>
<li>This is a list item with two paragraphs.

<p>This is the second paragraph in the list item.</p></li>

<li>Another item in the same list.</li>
</ul>

Nested List Items:

- text goes here

      -   subitem text 
      -   subitem text

- text goes here

Output:

<ul>
<li><p>text goes here</p>
<ul>
<li>subitem text</li>
<li>subitem text</li>
</ul></li>
<li><p>text goes here</p></li>
</ul>
Screen Shot 2019-08-28 at 11 24 47 AM

Expected output:

<ul>
<li>text goes here

<ul>
<li>subitem text</li>
<li>subitem text</li>
</ul></li>

<li>text goes here</li>
</ul>

IanMadd avatar Aug 28 '19 15:08 IanMadd

Adding <p> in a list indicates the list is a loose list. This rule defined in CommonMark spec, but blackfriday is not compliant to the spec fully, so the output may right to it.

I suggest you use a markdown processor compliant to CommonMark spec, I wrote one here 😄

88250 avatar Sep 15 '19 15:09 88250