Skip to content

List containing trailing empty list item not followed by a blank line #583

@neilmayhew

Description

@neilmayhew

This test input should be unchanged when rendered back to commonmark:

# abc

  - foo
  - bar
  - 

# def

xyz

Instead, cmark -t commonmark test-case.md produces:

# abc

  - foo
  - bar
  - 
# def

xyz

This happens whether or not the bullet is followed by a space in the empty list item.

The problem is in rendering rather than parsing, because the HTML output is:

<h1>abc</h1>
<ul>
<li>foo</li>
<li>bar</li>
<li></li>
</ul>
<h1>def</h1>
<p>xyz</p>

Also, empty list items are handled correctly when they occur in the middle of a list.

This is a problem for me because I'm trying to round-trip some markdown documents in order to make changes in a different part of the document, and the trip introduces these unrelated and undesirable changes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions