Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to write an ordered list which contains nested unordered lists (GitHub markdown)

From the docs here:
(https://guides.github.com/features/mastering-markdown/),
you can create a nested list by indenting one or more list items below another item.


enter image description here

But I'm trying to create an ordered list with nested unordered lists.


I tried this code:

1. Ordered One
  * Unordered First
  * Unordered Second
  * Unordered Third
1. Ordered Second
  * Unordered One
  * Unordered Two
  * Unordered Three

and what I get is this:

enter image description here


How can I write this so Ordered Second automatically gets number 2. and the unordered nested lists are properly indented?

Thank you.

like image 563
Alex Baban Avatar asked May 03 '18 21:05

Alex Baban


1 Answers

The issue you are experiencing is because your top-level list numbers in your example begin with a space in front. Eliminate that space and use three spaces for the sub-level indentation.

It isn't necessary to eliminate the space as it seems the key in GitHub's markdown is that there are three spaces differentiating the levels. So if you started with one space in front, the next level would have to have four spaces from the start of the line.

1. Ordered One
   * Unordered First
   * Unordered Second
   * Unordered Third
1. Ordered Second
   * Unordered One
   * Unordered Two
   * Unordered Three
  1. Ordered One
    • Unordered First
    • Unordered Second
    • Unordered Third
  2. Ordered Second
    • Unordered One
    • Unordered Two
    • Unordered Three
like image 94
Daniel Gimenez Avatar answered Oct 16 '22 15:10

Daniel Gimenez