我已经这样设置了索引文件:
Doc Title
==============================
..toctree::
:maxdepth: 3
:numbered:
:caption: Contents
01_file1
01.3_file2
如果内容因此...
01_file1.txt:
Level 1 section title
--------------------------------------------
Level 2 section title
............................................
Another Level 2 section title
............................................
对于01.3_file2.txt:
A third Level 2 section title
............................................
我之所以期待这一点,是因为狮身人面像将所有内容视为一个文档:
1. Level 1 section title
1.1 Level 2 section title
1.2 Another Level 2 section title
1.3 A third Level 2 section title
但相反,我得到这个:
1. Level 1 section title
1.1 Level 2 section title
1.2 Another Level 2 section title
2. A third Level 2 section title
我猜这是因为狮身人面像(或者可能是reST/Markdown?(用每个新的文本文件重新启动隐式标题级别。有没有办法得到我真正想要的东西?
引用 reST 文档...
而不是强加固定数量和顺序的章节标题装饰样式,强制执行的顺序将是遇到的顺序。遇到的第一种样式是最外层的标题(如HTML H1(,第二种样式是副标题,第三种样式是副标题,依此类推。
父文件确定其包含的子文件的标题级别。 要达到所需的效果,请从index
中删除01.3_file2
,然后将.. include:: 01.3_file2
放在01_file1.txt
中要包含的位置。
指数:
Doc Title
==============================
..toctree::
:maxdepth: 3
:numbered:
:caption: Contents
01_file1
01_file1.txt:
Level 1 section title
--------------------------------------------
Level 2 section title
............................................
Another Level 2 section title
............................................
.. include:: 01.3_file2.txt
01.3_file2.txt:
A third Level 2 section title
............................................
结果:
1. Level 1 section title
1.1 Level 2 section title
1.2 Another Level 2 section title
1.3 A third Level 2 section title