Some lists are not rendered as expected


(Jan P.) #1
  • 1

  • 2

  • 3

vs.

  • a
  • b

foo

  • c

123 is rendered as 3 individual lists, abc as 2 lists.

(Although this might also be a Markdown “feature”, please close if this is the case)


(Joshua Rosenfeld) #2

123 is rendered as one unordered list, just with spacing. ab and c are two lists, as you added a non-list element.

Here’s your markdown:

- 1
- 2

- 3

vs.

- a
- b

foo

- c

Note the raw HTML:

<div class="cooked">
    <ul>
        <li>
            <p>1</p>
        </li>
        <li>
            <p>2</p>
        </li>
        <li>
            <p>3</p>
        </li>
    </ul>
    <p>vs.</p>
    <ul>
        <li>a</li>
        <li>b</li>
    </ul>
    <p>foo</p>
    <ul>
        <li>c</li>
    </ul>
</div>

So everything appears to be working as I’d expect. What did you expect to happen?


(Jan P.) #3

To 1 and 2 not having any spacing, optionally also for 3 to be in its own list.

Basically:

    <ul>
        <li>
            1
        </li>
        <li>
            2
        </li>
    </ul>
    <ul>
        <li>
            3
        </li>
    </ul>

(Joshua Rosenfeld) #4

That’s not how Commonmark works. You need something between the lists, not just a blank line.


(Jan P.) #5

You are right, this is really an eample in the spec:
http://spec.commonmark.org/0.28/#example-275
What a …strange… thing.

The only solution for my problem seems to be this:

- foo
- bar
<br>
- baz
  • foo
  • bar

  • baz

(Jeff Atwood) #6