Include 不同文件的标题不匹配

Include 不同文件的标题不匹配,include,python-sphinx,restructuredtext,sections,toctree,Include,Python Sphinx,Restructuredtext,Sections,Toctree,我在斯芬克斯有一个非常基本的设置。目标为目标为: .. toctree:: :maxdepth: 3 one two 文件1和文件2如下所示: 一杯 #### Part #### ******* Chapter ******* Section ======= 2.rst: *************** Another Chapter *************** Another Section =============== 两个文件都有相同的格式,我希望以以

我在斯芬克斯有一个非常基本的设置。目标为目标为:

.. toctree::
   :maxdepth: 3

   one
   two
文件1和文件2如下所示:

一杯

####
Part
####

*******
Chapter
*******

Section
=======
2.rst:

***************
Another Chapter
***************

Another Section
===============
两个文件都有相同的格式,我希望以以下结构结束

Part
|- Chapter
  |- Section
|- Another Chapter
  |- Another Section
然而,斯芬克斯给了我

Part
|- Chapter
  |- Section
Another Chapter
|- Another Section

我之所以要分割这些文件,是因为它们相当大,我想让它们保持小,这样我就可以轻松地编辑它们。如何在不同的文件中获得相同的标题样式(使用相同的上划线/下划线字符)?

我相信您需要的是相同的标题样式。例如,在1.rst中,您将

####
Part
#### 

*******
Chapter
*******  

Section
=======

.. include:: 2.rst
.. include:: 3.rst
.. include:: 4.rst
这将包括2.rst以及当前文件中所需的其他文件,并继续当前结构布局。另外,将index.rst更改为1.rst

.. toctree::
   :maxdepth: 3

   1.rst
   part2.rst
   part3.rst