Skip to content

list item continuation line versus indented code block versus subsequent list #497

@mity

Description

@mity

(Note: This issue report is about disambiguation of the following snippet within context of current specification 0.28. There is also issue #495 discussing whether the future specification versions should be changed to interpret it as a nested list.)

How should this be interpreted?

100. foo
    * bar

Please note the 4 spaces of indentation in the 2nd line are important for the merit of the question.

Using some common sense I can see two possible interpretations, marked A and B below:

Interpretation A: List item continuation line

<ol start="100">
<li>foo
* bar</li>
</ol>

Rationale: * is not indented enough to start a nested list. And if there would be no * on the 2nd line, it would be continuation line for sure as well. See also http://spec.commonmark.org/0.28/#example-201 which is in some way analogous to this interpretation.

Interpretation B: An indented code block

<ol start="100">
<li>foo</li>
</ol>
<pre><code>* bar
</code></pre>

Rationale: If we do not see the 2nd line as a continuation line, it has to start a new top-level block. Taking the principle of uniformity into account, the 2nd line should be then interpreted the same way as if there is no 1st line at all. And four spaces imply an indented code block.

Interpretation C: Subsequent list

CMark currently interprets it differently, as follows:

<ol start="100">
<li>foo</li>
</ol>
<ul>
<li>bar</li>
</ul>

However I see that interpretation troublesome as it is imho clearly against the principle of uniformity as explained in interpretation B.

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