question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Nested lists: why 2 spaces for unordered lists, 4 spaces for ordered lists?

See original GitHub issue

Why are there difference in the required spaces for ordered/unordered lists? The following will work fine:

* one
* two
* three
  * sub1
  * sub2

1. one
2. two
3. three
    1. sub1
    2. sub2

But change the 2 spaces to 4 i in the first list, or the 4 spaces to 2 in the second list, and it will give a warning. Why not consistence?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
gandalfsaxecommented, Jul 20, 2018

Thanks for your answer. The section in the CommonMark is quite dense and goes into a lot of things, including indented paragraphs in general, but I found the relevant section here right below this example: https://spec.commonmark.org/0.28/#example-256

So as I understand it: the CommonMark spec’s point of referenec is that it wants two spaces of indentation for sublists. However due to the fact the numbered lists have an extra character compared to unordered lists (* vs. 1. ), we want three spaces in numbered sublists. In other words, we care more about visually indentation than the number of spaces being the same in both kinds of sublists, correct?

I don’t know if I like this. Seems to over-emphasize the visual appearance at the cost of simplicity. The difficulty for me comes in when I’m working with markdown in practice in editors (in my case VSCode) that support a fixed settings of 2 or 4 spaces of indentation. Any solution to this? It seems very sub-optimal to have to think and manually insert the correct number of spaces for sublists when writing markdown.

0reactions
DavidAnsoncommented, Jul 25, 2018

I’m afraid I don’t have any good suggestions for that issue. I agree with you that 2 spaces after the ordered list marker doesn’t look as good and that lists of 10 or more items seem uncommon, BUT I appreciate the tabbing scenario they are trying to handle without breaking existing documents. To my thinking, code fences are better because they are more explicit, but there are plenty of places that don’t use them.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Markdown Tutorial - Nested Lists - CommonMark
You can mix ordered and unordered lists. To nest a paragraph or blockquote, indent by either 4 spaces or one tab.
Read more >
How to write an ordered list which contains nested unordered ...
1 Answer 1 · 2. I don't have a space in front of the top-level numbers 1. , but using three spaces for...
Read more >
Ordered, Unordered, and Nested Lists #tryminim - YouTube
HTML lists present information in a recognizable, readable, and semantic way.One common example of the use of lists is the links in a ......
Read more >
Incorrect spaces in nested markdown lists - GitLab.org
The empty lines come from the ol and ul elements. Each of them has a margin bottom. But this should not be the...
Read more >
How To Create Nested Lists In Markdown – What Is Mark Down
The indentation can be one or more spaces. For example, to create a nested list with two items under the first item, you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found