How to master nesting things in Markdown lists
Posted on
Updated on
Common issue when nesting things
Did you ever struggled with combining nested lists with ordered lists, code blocks, blockquotes...? You would usually break the numbering and/or add an empty line before your nested thing...
This always bothered my twisted mind, and today was this one time too much!
So I looked up for it.
The hint came from the author of the awesome markdownlint linter:
Markers for nested lists should begin under the text of the previous item — for numbered lists that's typically 3 vs. 2 spaces.
— David Anson, MD029 (ol-prefix) and nested unordered lists in ordered lists
Example
Here is an hopefully comprehensive example to illustrate the above statement:
1. One
- Item with a 3 spaces indent so the `-` is under the `O` of One
2. Two
3. Three
> This blockquote has a 3 spaces indent so the first of the 2 backticks is under the `T` of Three
4. Four
5. Five
6. Six
7. Seven
8. Eight
9. Nine
10. Ten
1. Item with a 4 spaces indent so the `1` is under the `T` of Ten
2. ...
My twisted mind can now go to rest and I now have one less hassle when it comes to author Markdown 🎉