Sphinx: numbering of resume list after section notes

Consider the following list in ReStructuredText :

Broken list example ------------------- #. First do spam #. Then do ``eggs`` .. note:: Nobody expects the Spanish Inquisistion #. The list restarts after the note 

When the list is compiled in Sphinx , the number after the note is reset to 1 :

List number restart result screenshot

Any idea how to continue the numbered list after the note section?

+8
source share
1 answer

The list break is caused by the fact that note is a standalone element and not a child of the second element with a number. To prevent list breaks, run the note directive in the same indent (in this case, 3 spaces) as the text of the list item of the numbered parent numbered list. So instead of your reStructuredText sample, try the following:

 Fixed list example ------------------ #. First do spam #. Then do ``eggs`` .. note:: Nobody expects the Spanish Inquisistion #. Then do spam and ``eggs``. 

This is one of those reStructuredText things that are not easy to detect, and are especially well documented; see this question on nested lists for a closely related issue .

+15
source

Source: https://habr.com/ru/post/984453/


All Articles