reStructuredText 中的嵌套子列表,代码块不起作用
Nested sub-list in reStructuredText with code blocks not working
我正在使用 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.
上面给出了类似的结果(很难在 Markdown 中准确重现,但希望你明白了):
Tester Page
Below are some test paragraphs.
This is some text.
a. This is a sub-bullet, with an example:
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.
我已经调整双冒号、白色-space 和反引号至少一个小时了,但不知道如何正确设置格式。也许 reStructuredText 不够通用,无法处理带有嵌入式代码块的嵌套列表?
你必须非常小心垂直和水平的空白。嵌套列表必须用空行与父列表项分开。文字块中的代码示例必须正确缩进。
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.
我正在使用 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.
上面给出了类似的结果(很难在 Markdown 中准确重现,但希望你明白了):
Tester Page
Below are some test paragraphs.
This is some text.
a. This is a sub-bullet, with an example:
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.
我已经调整双冒号、白色-space 和反引号至少一个小时了,但不知道如何正确设置格式。也许 reStructuredText 不够通用,无法处理带有嵌入式代码块的嵌套列表?
你必须非常小心垂直和水平的空白。嵌套列表必须用空行与父列表项分开。文字块中的代码示例必须正确缩进。
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.