关于python sphinx:带有代码块的reStructuredText中的嵌套子列表不起作用

Nested sub-list in reStructuredText with code blocks not working

我正在使用sphinx尝试从.rst文件创建HTML文档。我正在尝试创建一个带有编号列表(1.,2.,...)的文档,并带有一个显示示例代码的嵌套子列表(a。,b,c。,...)。但是我很难弄清楚语法来使嵌套子列表起作用。这是我尝试过的示例.rst文件:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
===========
Tester Page
===========

Below are some test paragraphs.

1. This is a paragraph detailing a higher level step, with 3 sub-steps.
 a. This is a sub-bullet, with an example:
::

    ls -l foo.txt

 b. I can't get this line to not display as part of the code block! This is another sub-bullet, with an example:
::

    git add bar.txt

2. This is step 2.

This is the end of the document.

上面的结果给了我类似的结果(很难在Markdown中精确再现,但希望您能理解):

Tester Page

Below are some test paragraphs.

  • This is some text.

    a. This is a sub-bullet, with an example:

  • 1
    2
    3
    4
      ls -l foo.txt

    b. This is another sub-bullet, with an example:
      git add bar.txt
  • This is step 2.
  • This is the end of the document.

    我已经对双分号,空格和反引号进行了至少一个小时的调整,无法弄清楚如何正确格式化。也许reStructuredText不够通用,不足以处理带有嵌入式代码块的嵌套列表?


    您必须非常注意垂直和水平空白。嵌套列表必须与父列表项之间用空白行分隔。文字块中的代码示例必须正确缩进。

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    Below are some test paragraphs.

    1. This is a paragraph detailing a higher level step, with 3 sub-steps.

       a. This is a sub-bullet, with an example::

             ls -l foo.txt

       b. I can get this line to display as part of the code block!
          This is another sub-bullet, with an example::

             git add bar.txt

    2. This is step 2.