Python sphinx 在索引目录树中包含子目录中的目录树

Python sphinx 在索引目录树中包含子目录中的目录树,python-sphinx,subdirectory,toctree,Python Sphinx,Subdirectory,Toctree,我想记录的项目结构如下: /top Index.rst /a toctree_a.rst (contains doc and doc2) doc.rst doc2.rst /b toctree_b.rst (contains doc4 and doc3) doc3.rst doc4.rst 我想引用子目录(a和b)中的目录树s,以便项目目录树可以看到项目树中的4个文档 当文档位于一个目录中时,我知道如何执行此操作,

我想记录的项目结构如下:

/top
Index.rst
     /a
     toctree_a.rst (contains doc and doc2)
     doc.rst
     doc2.rst
     /b
     toctree_b.rst (contains doc4 and doc3)
     doc3.rst
     doc4.rst
我想引用子目录(a和b)中的
目录树
s,以便项目
目录树
可以看到项目树中的4个文档


当文档位于一个目录中时,我知道如何执行此操作,但如果文档位于子目录中,我不知道如何执行此操作。我试图保持我的项目结构完整,而不必将所有文件移动到一个目录中。我做了一些研究,发现
。。include::directive
可能是要走的路线,但我不知道如何正确使用它。

您可以告诉index.rst中的目录树从子目录获取文件,如下所示:

内容:

.. toctree::
   :maxdepth: 2

    a/doc
    a/doc2
    b/doc3
    b/doc4
该方法的工作原理与它们在同一目录中的工作原理相同