According the list-items rule (that sublists need to be indented to the column of the first non-whitespace character after the list marker), the following Markdown:
1. item
2. another item
1. sub-list item
2. sub-list another item
3. sub-list last item
3. last item
Represents a single non-nested list:
<ol>
<li><p>item</p></li>
<li><p>another item</p></li>
<li><p>sub-list item</p></li>
<li><p>sub-list another item</p></li>
<li><p>sub-list last item</p></li>
<li><p>last item</p></li>
</ol>
Which seems wrong, because using a 2-space indent is enough to have the list rendered correctly with marked, redcarpet (& therefore GitHub), the original Markdown implementation, and PHP Markdown (see comparison on Babelmark).
I havenāt gotten any stats yet on how popular 2 space indents are among people who write Markdown, but since thereās at least one styleguide recommending it, I think itās more than an edge-case.
For people who are thinking about indentation in terms of the number of spaces before the list marker, itās quite strange that you can use 2 spaces to nest a list within an unordered list, but need at least 3 spaces to nest within an ordered one. The absurdity of this rule is illustrated further when you have ordered lists in the 2-3 digit range:
99. list item 99
- sublist item
- sublist item 2
100. list item 100
- sublist item
- sublist item 2
The tutorial at http:// Markdown Tutorial - Nested Lists says:
To nest one list within another, indent each item in the sublist by four spaces.
ā¦But that doesnāt work in the above example because once you get above 100 you need to switch to 5-space minimum indents (see comparison on Babelmark).
Iāve read the āmotivationā section of the spec discussing this rule, but Iām unconvinced because cases like:
1. foo
indented code
ā¦Are already handled perfectly by all parsers. And cases like:
10. foo
bar
ā¦Probably should be read as a list item with a subparagraph.
This was moved from https:// nested ordered lists indented with 2 spaces are broken Ā· Issue #399 Ā· commonmark/commonmark-spec Ā· GitHub and a few other discussions have covered the same topic:
- https:// github.com/npm/newww/issues/1228
- http:// Could also support two spaces for list indentation?
- http:// Indentation requirement of sub lists inside ordered list items
PS: The āchanging the bullet or ordered list delimiter starts a new listā rule is an awful thing to put in the standard. No other parsers do that.
PPS: Discourse says ānew users can only put 4 links in a postā, so you should go to GitHub to read this post without most of the links intentionally broken or removed.