代码块不起作用的 reStructuredText 中的嵌套子列表

Ogr*_*m33 3 restructuredtext python-sphinx

我正在使用 sphinx 尝试从 .rst 文件创建 HTML 文档。我正在尝试创建一个具有编号列表 (1., 2., ...) 的文档,其中包含一个显示示例代码的嵌套子列表 (a., b, c., ...)。但是我在梳理语法以使嵌套子列表起作用时遇到了麻烦。这.rst是我尝试过的示例文件:

===========
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.
Run Code Online (Sandbox Code Playgroud)

上面给了我一个类似的结果(很难在 Markdown 中完全重现,但希望你能理解):

测试页面

下面是一些测试段落。

  1. 这是一些文字。

    一种。这是一个子项目符号,举个例子:

  ls -l foo.txt

b. This is another sub-bullet, with an example:
  git add bar.txt
Run Code Online (Sandbox Code Playgroud)
  1. 这是第 2 步。

这是文档的结尾。

我一直在调整双冒号、空格和反引号至少一个小时,但不知道如何正确格式化。也许 reStructuredText 的通用性不足以处理带有嵌入代码块的嵌套列表?

mzj*_*zjn 8

您必须非常小心垂直和水平空白。嵌套列表必须通过空行与父列表项分开。文字块中的代码示例必须正确缩进。

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.
Run Code Online (Sandbox Code Playgroud)