I am using Sphinx to write a documentation for a Python program. I would like to create an ordered list, with a nested list, and with automatic numbering.
I would like to obtain something like this:
Here it follows a numbered list
- This is the first item of the list
- This is the second one
- The second item has a nested list with two items
- this is the last item of the nested list
- The parent list continues with its third item
Everything is ok if I explicitly use numbers for the numbered list. The issue raises when I want to use automatic numbering, because I want to remain flexible. The list is long and could change in the future, and I do not want to change all of the numbers when I introduce a new item.
I have tried using the following code:
Here it follows a numbered list
#. This is the first item of the list
#. This is the second one
* The second item has a nested list with two items
* this is the last item of the nested list
#. The parent list continues with its third item
And the result I get is the following:
Here it follows a numbered list
- This is the first item of the list
This is the second one
- The second item has a nested list with two items
- this is the last item of the nested list
.1. The parent list continues with its third item
[I have to add some character, here a dot, for the 3rd item or the markdown system in stackoverflow shows a 3!]
As you can see the numbering after the nested list restarted from the beginning.
You have to properly indent the two items of the nested bullet list to match the text of the parent list, so just add a space like this:
#. This is the first item of the list
#. This is the second one
* The second item has a nested list with two items
* this is the last item of the nested list
#. The parent list continues with its third item
Full explanation here