Sphinx: Resume list numbering after a note section

前端 未结 1 656
广开言路
广开言路 2020-12-11 01:46

Consider the following list in ReStructuredText:

Broken list example
-------------------

#. First do spam
#. Then do ``eggs``

  .. note::

    Nobody expec         


        
相关标签:
1条回答
  • 2020-12-11 02:29

    The discontinuity of the list is caused by the note being a standalone element, not a child of the second numbered list element. To prevent the discontinuity of the list, start the note directive at the same indentation (in this case, 3 spaces) as the the text of the intended parent numbered list element. So instead of your sample reStructuredText, try this:

    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 things about reStructuredText that's neither easy to spot, nor particularly well documented; see this question on nested lists for a closely-related problem.

    0 讨论(0)
提交回复
热议问题