Reputation: 6049
I want to make a nested list in the markdown file. I got stuck at nesting the list at the third level.
Problem:
If I write the above code in the code fence block it works correctly but I want to do the nesting of list without the code fence.
1. ABC
2. ABC
2.1 ABC
2.2 ABC
2.2.1 ABC
2.2.2 ABC
2.2.3 ABC
2.3 ABC
2.4 ABC
3. ABC
Upvotes: 1
Views: 1119
Reputation: 42497
The problem is that 2.2
and 2.2.1
are not valid list markers. At a minimum, they do not end with a period.
You don't tell us which Markdown parser you are using. Some tools may support 2.2.
as a valid list marker (note the extra dot at the end of the number), but most do not. Generally, it is expected that there is only one period in the entire number at the end.
As the original rules explain:
It’s important to note that the actual numbers you use to mark the list have no effect on the HTML output Markdown produces. The HTML Markdown produces from the above list is:
<ol> <li>Bird</li> <li>McHale</li> <li>Parish</li> </ol>
If you instead wrote the list in Markdown like this:
1. Bird 1. McHale 1. Parish
or even:
3. Bird 1. McHale 8. Parish
you’d get the exact same HTML output. The point is, if you want to, you can use ordinal numbers in your ordered Markdown lists, so that the numbers in your source match the numbers in your published HTML. But if you want to be lazy, you don’t have to.
Therefore, your list should be formatted like this:
1. ABC
2. ABC
1. ABC
2. ABC
1. ABC
2. ABC
3. ABC
3. ABC
4. ABC
3. ABC
Of course, that doesn't provide for your nested numbers, but those nested numbers wouldn't be preserved in the HTML anyway. You would need some custom CSS to get the HTML to alter the way "bullets" are displayed (perhaps using list-style-type. Unfortunately, nested numbers is not an option there either. That may require some additional CSS hacks (that link points to the first relevant result I found in a quick search. I can't vouch for it). However, that would be a separate question to this one.
Upvotes: 2