Python sphinx 防止sphinx重新启动每个文件的节编号
我的索引文件设置如下:Python sphinx 防止sphinx重新启动每个文件的节编号,python-sphinx,restructuredtext,sections,toctree,Python Sphinx,Restructuredtext,Sections,Toctree,我的索引文件设置如下: Doc Title ============================== ..toctree:: :maxdepth: 3 :numbered: :caption: Contents 01_file1 01.3_file2 如果内容是这样的 01_file1.txt: Level 1 section title -------------------------------------------- Level 2 secti
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
............................................
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
............................................
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
我猜这是因为Sphinx(或者可能是reST/Markdown?)会在每个新文本文件中重新启动隐式标题级别。有没有办法得到我真正想要的
引用
与强制规定固定数量和顺序的章节标题装饰样式不同,强制执行的顺序将是遇到的顺序。遇到的第一种样式是最外层的标题(如HTMLH1),第二种样式是副标题,第三种样式是子标题,依此类推
父文件确定其包含子文件的标题级别。要达到预期效果,请从
索引中删除01.3_文件2
,然后放置。。将::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
............................................
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
............................................
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
完全正确。我已经用你描述的演示更新了你的答案。