Skip to content

Clarify whether loose lists are transitive #803

Open
@davidje13

Description

@davidje13

In the current spec:

A list is loose if any of its constituent list items are separated by blank lines, or if any of its constituent list items directly contain two block-level elements with a blank line between them. Otherwise a list is tight. (The difference in HTML output is that paragraphs in a loose list are wrapped in <p> tags, while paragraphs in a tight list are not.)

This is ambiguous in the case of nested lists (specifically whether "directly contain two block-level elements with a blank line between them" should apply to the sub-list items, or only to the sub-list as a whole), and there is no test case for it.

An example input:

- foo
- bar
  - zig

  - zag

generated output from "dingus":

<ul>
  <li>foo</li>
  <li>
    bar
    <ul>
      <li>
        <p>zig</p>
      </li>
      <li>
        <p>zag</p>
      </li>
    </ul>
  </li>
</ul>

alternative interpretation:

<ul>
  <li>
    <p>foo</p>
  </li>
  <li>
    <p>bar</p>
    <ul>
      <li>
        <p>zig</p>
      </li>
      <li>
        <p>zag</p>
      </li>
    </ul>
  </li>
</ul>

It is not entirely clear if this is intended or not, and some implementations which try to conform to commonmark take the approach of making both lists loose (among other partial outputs which are unlikely to be intentional)

What is the intended behaviour here? Can it be clarified / added as an example?

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