Skip to content

Fix support for nested lists inside #63

@Peque

Description

@Peque

You can now write nested lists like so:

- Foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo
    bar foo bar foo bar foo bar foo bar.

    Another paragraph within the first list item.

- Foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo
    bar foo bar foo bar foo bar foo bar.

    Another paragraph within the second list item.

Which renders as expected: one single <ul> containing two <li> each with two <p>.

According to the reference Markdown syntax, followed by Python-Markdown and, hence, mkdocs:

List items may consist of multiple paragraphs. Each subsequent paragraph in a list item must be indented by either 4 spaces or one tab

However, when nesting them inside a definition list, instead of:

:   Definition description.

    - Foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo
        bar foo bar foo bar foo bar foo bar.

        Another paragraph within the list item.

They get formatted as:

:   Definition description.

    - Foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar
      foo bar foo bar foo bar foo bar foo bar.

      Another paragraph within the list item.

The former renders the expected HTML:

<dd>
<p>Definition description.</p>
<ul>
<li>
<p>Foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo
    bar foo bar foo bar foo bar foo bar.</p>
<p>Another paragraph within the list item.</p>
</li>
</ul>
</dd>

While the latter results in an HTML where "Another paragraph" is not inside the list item, but rendered as a new paragraph inside the description:

<dd>
<p>Definition description.</p>
<ul>
<li>Foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar
  foo bar foo bar foo bar foo bar foo bar.</li>
</ul>
<p>Another paragraph within the list item.</p>
</dd>

This issue is related to #58 (comment).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions