Sphinx:在笔记部分后继续列表编号

Ada*_*tan 11 restructuredtext python-sphinx continuation numbered-list

请考虑ReStructuredText中的以下列表:

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

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

  .. note::

    Nobody expects the Spanish Inquisistion

#. The list restarts after the note
Run Code Online (Sandbox Code Playgroud)

Sphinx中编译列表时,注释后的数字将重置为1:

列表编号重启结果截图

任何想法如何在一note节后继续编号列表?

ddb*_*eck 20

列表的不连续性是由note独立元素引起的,而不是第二个编号列表元素的子元素.为防止列表不连续,请note在同一缩进处(在本例中为3个空格)启动指令作为预期父编号列表元素的文本.因此,请尝试以下方法,而不是您的示例reStructuredText:

Fixed list example
------------------

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

   .. note::

      Nobody expects the Spanish Inquisistion

#. Then do spam and ``eggs``.
Run Code Online (Sandbox Code Playgroud)

这是关于reStructuredText的那些事情之一,既不容易发现,也没有特别好记录; 看到在嵌套列表这个问题的一个密切相关的问题.