# Ordered lists and sublist starts

**URL:** <https://talk.commonmark.org/t/ordered-lists-and-sublist-starts/3693>\
**Category:** Spec\
**Created:** [November 11, 2020, 10:46pm UTC](https://talk.commonmark.org/t/ordered-lists-and-sublist-starts/3693 "2020-11-11T22:46:06Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![jackdw](https://cdn.commonmark.org/letter_avatar_proxy/v2/letter/j/51bf81/32.png) [@jackdw](https://talk.commonmark.org/u/jackdw)\
**Post date:** [November 11, 2020, 10:46pm UTC](https://talk.commonmark.org/t/ordered-lists-and-sublist-starts/3693/1 "2020-11-11T22:46:06Z")

</div>

Looking through the posts on this, I am feeling a bit confused as to what the correct thing is regarding ordered sublists, and the reasoning behind them.

Given this Markdown

```auto
1. one
   1. one-A
2. two
   2. two-A
3. three

```

CommonMark (0.29.2 via Babelmark2) gives me the output I would expect:

```auto
<ol>
<li>one
<ol>
<li>one-A</li>
</ol>
</li>
<li>two
<ol>
<li>two-A</li>
</ol>
</li>
<li>three</li>
</ol>

```

To be clear, this makes perfect sense to me. I typed in 3 list items for the first list, and 2 sublists, one for each of the first two items. To me, this is obvious.

It is when i change the Markdown that I have an issue:

```auto
1. one
   1. one-A
2. two
   2. two-A
3. three

```

From a obvious point of view, I am now starting the second sublist at 2 instead of 1. In the case where I am providing editing notes for a friend, who often types in lists and sublists for her first draft, this is a perfectly legit notation. I am deliberately skipping the first item in the second list as I do not have any comments on the first item of her second list. Unless I am missing something obvious, to me this is the most reasonable interpretation of this Markdown.

This conflicts with the output for this which is:

```auto
<ol>
<li>one
<ol>
<li>one-A</li>
</ol>
</li>
<li>two
2. two-A</li>
<li>three</li>
</ol>

```

I did follow the conversations about the second sublist and paragraphs from other posts, but can someone please provide a good example of how this output is a more reasonable interpretation of the list I type in than having a second sublist starting at 2?

---

<div class="post-metadata">

**Author:** ![jackdw](https://cdn.commonmark.org/letter_avatar_proxy/v2/letter/j/51bf81/32.png) [@jackdw](https://talk.commonmark.org/u/jackdw)\
**Post date:** [November 11, 2020, 10:56pm UTC](https://talk.commonmark.org/t/ordered-lists-and-sublist-starts/3693/2 "2020-11-11T22:56:50Z")

</div>

Additional piece of information. In going through some more tests, came across this, which does parse the way I would expect it:

```auto
1. 2. foo

```

---

<div class="post-metadata">

**Author:** ![mity](https://cdn.commonmark.org/user_avatar/talk.commonmark.org/mity/32/1040_2.png) [@mity](https://talk.commonmark.org/u/mity)\
**Post date:** [November 12, 2020, 9:45am UTC](https://talk.commonmark.org/t/ordered-lists-and-sublist-starts/3693/3 "2020-11-12T09:45:28Z")

</div>

The both markdown examples in the original post look same, maybe a copy&paste error?

---

<div class="post-metadata">

**Author:** ![jackdw](https://cdn.commonmark.org/letter_avatar_proxy/v2/letter/j/51bf81/32.png) [@jackdw](https://talk.commonmark.org/u/jackdw)\
**Post date:** [November 13, 2020, 4:36am UTC](https://talk.commonmark.org/t/ordered-lists-and-sublist-starts/3693/4 "2020-11-13T04:36:57Z")

</div>

Good catch, and to think I double checked it before posting.

The first example should be:

```auto
1. one
   1. one-A
2. two
   1. two-A
3. three

```

---

<div class="post-metadata">

**Author:** ![Crissov](https://cdn.commonmark.org/user_avatar/talk.commonmark.org/crissov/32/1455_2.png) [@Crissov](https://talk.commonmark.org/u/Crissov)\
**Post date:** [November 13, 2020, 9:41am UTC](https://talk.commonmark.org/t/ordered-lists-and-sublist-starts/3693/5 "2020-11-13T09:41:12Z")

</div>

[spec](https://spec.commonmark.org/0.29/#list-items):

> Exceptions:
> 
> 1. When the first list item in a [list](https://spec.commonmark.org/0.29/#list) interrupts a paragraph—that is, when it starts on a line that would otherwise count as [paragraph continuation text](https://spec.commonmark.org/0.29/#paragraph-continuation-text)—then  
> (a) the lines _Ls_ must not begin with a blank line, and  
> (b) if the list item is ordered, the start number must be 1.

This is trying to avoid parsing arbitrary numbers followed by a period at the start of a line as list items. In some languages, this is standard for ordinal numbers and therefore occurs frequently in dates, e.g. “12. November” in German.

---

<div class="post-metadata">

**Author:** ![jackdw](https://cdn.commonmark.org/letter_avatar_proxy/v2/letter/j/51bf81/32.png) [@jackdw](https://talk.commonmark.org/u/jackdw)\
**Post date:** [November 13, 2020, 8:13pm UTC](https://talk.commonmark.org/t/ordered-lists-and-sublist-starts/3693/6 "2020-11-13T20:13:25Z")

</div>

That is a good case. My question is more geared towards whether or not it makes sense rather than “is it in the spec”

So, if I understand correctly:

```auto
1. my list
   2. my sub-list

```

is interpreted as `2. my sub-list` is an extension of the paragraph started in the main list item `1. my list` and not the start or a sub-list. Based on another part of the spec, as an indented code block cannot interrupt a paragraph, it would not be interpreted as an indented code block, but as an extension of the first paragraph. So from a specification point of view, as it is written, I think this is solid.

My question is more around whether or not this fulfils the goal of “readable as-is”.

While I agree that having the above `2. my sub-list` could fall into that category of “it may be”, the most obvious reading to me is that it is a sub-list.

I guess I am trying to open a conversation about readability. For me, if it looks like a list, it should act like a list. To me, regardless of any other concern, that Markdown code snippet looks like a list with a sub-list, regardless of what the starting numbers are.

Hoping for some good conversation on this…

---

<div class="post-metadata">

**Author:** ![jackdw](https://cdn.commonmark.org/letter_avatar_proxy/v2/letter/j/51bf81/32.png) [@jackdw](https://talk.commonmark.org/u/jackdw)\
**Post date:** [November 14, 2020, 3:45am UTC](https://talk.commonmark.org/t/ordered-lists-and-sublist-starts/3693/7 "2020-11-14T03:45:19Z")

</div>

Back to the one example I added after the original:

```auto
1. 2. abc

```

this gets parsed as:

```auto
<ol>
<li>
<ol start="2">
<li>abc</li>
</ol>
</li>
</ol>

```

I do understand the Exceptions that Crissov posted, but it seems weird to me that having both numbers on the same line is honored, but starting the inner list on a newline is not. It just seems inconsistent to me.

Just to be clear, I am not arguing for the sake or arguing, just trying to understand things better.

---

<div class="post-metadata">

**Author:** ![vas](https://cdn.commonmark.org/user_avatar/talk.commonmark.org/vas/32/1267_2.png) [@vas](https://talk.commonmark.org/u/vas)\
**Post date:** [November 14, 2020, 7:56am UTC](https://talk.commonmark.org/t/ordered-lists-and-sublist-starts/3693/8 "2020-11-14T07:56:25Z")

</div>

> To me, regardless of any other concern, that Markdown code snippet looks like a list with a sub-list, regardless of what the starting numbers are.

That’s only true for your specific example. Consider:

```auto
1. The project risked missing
   its deadline of March
   13. A meeting was called.
2. The architect would take flight
   457. It was the red eye. 
3. She would stay at the Hilton, room
   22. It had an ocean view. 

```

In other words, it’s obvious to humans. So until we can incorporate AI into the markdown parser, we have to settle for an imperfect heuristic.

---

<div class="post-metadata">

**Author:** ![Crissov](https://cdn.commonmark.org/user_avatar/talk.commonmark.org/crissov/32/1455_2.png) [@Crissov](https://talk.commonmark.org/u/Crissov)\
**Post date:** [November 14, 2020, 3:20pm UTC](https://talk.commonmark.org/t/ordered-lists-and-sublist-starts/3693/9 "2020-11-14T15:20:08Z")

</div>

I think this was the last thread on the topic, which also discusses several alternatives:

> [@Blank lines before lists, revisited](https://talk.commonmark.org/t/blank-lines-before-lists-revisited/1990/22):
>
> To weigh in on the proposals: (1) (single-digit start numbers) seems okay to me. It might fix some practical problems (and might cause some others). On the other hand, even with this fix we’d have a mismatch between parser behavior and the spec of the sort described in commonmark/cmark#204. (3) is bad for the reason I just gave in my previous post. One-item lists are, in general, useful, so we don’t want to rule them out altogether. I suppose we could require at least two items when t…

---

<div class="post-metadata">

**Author:** ![jgm](https://cdn.commonmark.org/user_avatar/talk.commonmark.org/jgm/32/1360_2.png) [@jgm](https://talk.commonmark.org/u/jgm)\
**Post date:** [November 14, 2020, 11:55pm UTC](https://talk.commonmark.org/t/ordered-lists-and-sublist-starts/3693/10 "2020-11-14T23:55:52Z")

</div>

This is definitely a rough edge, and I’m not 100% happy with the solution we currently have.

> [@Blank lines before lists, revisited](https://talk.commonmark.org/t/blank-lines-before-lists-revisited/1990/22):
>
> To weigh in on the proposals: (1) (single-digit start numbers) seems okay to me. It might fix some practical problems (and might cause some others). On the other hand, even with this fix we’d have a mismatch between parser behavior and the spec of the sort described in commonmark/cmark#204. (3) is bad for the reason I just gave in my previous post. One-item lists are, in general, useful, so we don’t want to rule them out altogether. I suppose we could require at least two items when t…

If we were inventing a light markup language from scratch, I’d want to require a blank line before a list or sublist (see [Beyond Markdown](https://talk.commonmark.org/t/beyond-markdown/2787)), for this and many other reasons.

But we’re not, so we need to find a compromise that works.
