Python sphinx 代码块不工作的StructuredText中的嵌套子列表
我正在使用sphinx尝试从.rst文件创建HTML文档。我试图创建一个文档,它有一个编号的列表(1,2.,…),其中有一个嵌套的子列表(a,b,c.,…),显示示例代码。但是我很难弄清楚让嵌套子列表工作的语法。以下是我尝试过的Python sphinx 代码块不工作的StructuredText中的嵌套子列表,python-sphinx,restructuredtext,Python Sphinx,Restructuredtext,我正在使用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, wi
.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中精确复制,但希望您能理解):
测试页面
下面是一些测试段落
我已经调整了双冒号、空格和反引号至少一个小时了,但我不知道如何正确设置格式。也许StructuredText的功能还不足以处理嵌入代码块的嵌套列表?您必须非常小心处理垂直和水平空白。嵌套列表必须与父列表项以空行分隔。文字块中的代码示例必须正确缩进
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.
好的,这让我找到了我需要的解决方案!总而言之:空行应该是空的空行(注意像TextPad和Eclipse这样的自动缩进和留空格的编辑器)!另外,3个空格的额外缩进似乎是一个神奇的数字。确保所有项目都垂直对齐,如果有疑问,请进一步缩进!这对我很有用。@OgrePsalm33空格不是必需的,可能会妨碍您的编辑器。请参阅和我的,我想知道这是否适用于报价中的
代码块
?我试了很多,但我不知道规则是什么。如果问题不同,我可能会提出一个新问题。啊,没关系,我发现了问题,我的代码中有一个看不见的字符。
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.