Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Include toctree from subdirectory in Index toctree

The structure of my project that I want to document is as follows:

/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

I want to reference the toctrees in the sub-directories (a and b) so that the project toctree can see the 4 documents in the project tree.

I know how do do this when the documents are in one directory, but I don't know how to do this if I have them in a subdirectory. I am trying to keep the structure of my project intact without having to move all files into one directory. I have done some research, and found that .. include:: directive may be the route to go, but I could not figure out how to use it properly.

like image 938
Almidas Avatar asked Mar 12 '23 10:03

Almidas


1 Answers

you can tell your toctree in your index.rst to get the file from a sub-directory like so:

Contents:

.. toctree::
   :maxdepth: 2

    a/doc
    a/doc2
    b/doc3
    b/doc4

That method works just like they would be in the same directory

like image 171
Yarmek Avatar answered Mar 25 '23 03:03

Yarmek