Unclear spec regarding nested ordered lists with start numbers

tl:dr, look at this example.

I was looking into switching between 2 different commonmark-compliant C# libraries when I noticed that the way they treated nested ordered lists differed if i started the nested list with a number that isn’t 1.

Take the following code:

10. asd
11. asd
    1. start at one

---

10. asd
11. asd
    3. start at three

Using CommonMark.Net this renders as

<ol start="10">
<li>asd</li>
<li>asd
<ol>
<li>start at one</li>
</ol>
</li>
</ol>
<hr>
<ol start="10">
<li>asd</li>
<li>asd
<ol start="3">
<li>start at three</li>
</ol>
</li>
</ol>

However, using Markdig as well as the Commonmark js reference i get the following result (which isnt even a nested list):

<ol start="10">
<li>asd</li>
<li>asd
<ol>
<li>start at one</li>
</ol>
</li>
</ol>
<hr />
<ol start="10">
<li>asd</li>
<li>asd
3. start at three</li>
</ol>

I had a look at the latest spec (0.26 at time of writing) and I cannot find anything regarding startnumbers on nested ordered lists, meaning I think there is room for clarification here.

Personally, I think commonmark.Net’s approach is more correct as it maintains the existence of the nested list which looks more consistent.

What do others think?

This makes sense.

interestingly enough, commonmark 0.26.0 and league/commonmark (PHP) produce substantially different output here. It is league/commonmark that produces similar output to CommonMark.Net, including a sublist starting with 3:

<ol start="10">
<li>asd</li>
<li>asd
<ol>
<li>start at one</li>
</ol>
</li>
</ol>
<hr>
<ol start="10">
<li>asd</li>
<li>asd
<ol start="3">
<li>start at three</li>
</ol>
</li>
</ol>

As for backwards compatibility, most implementations on BabelMark create a sublist that starts with 1. Only commonmark 0.26.0 and markdig don’t produce a sublist at all.

This divergence is due to a relatively recent change to CommonMark (which I’m still not fully persuaded is the right approach).

The change says that an ordered list can only interrupt a paragraph (i.e. with no preceding blank line) when it starts with 1.. For motivation and background (as well as some dissent), see Blank lines before lists, revisited