7
votes

I am trying to write documentation and want and have multiply files used by multiple toc trees. Previously I used an empty file with .. include:: <isonum.txt> however, this does not work for multiply files in a directory with sub directories. Another solution I have used was to use a relative file path to the index file I am linking to. However this messes up the sphinx nav tree. So my question is how to include a directory of files with RST and Sphinx?

2
please check this URLit will be useful to lift your content quality upWillie Cheng
You might want to have a look at my solution since I needed something similar. Basically, generate (either manually or automatically) a single file (e.g. include.rst) that contains one .. include:: directive per file. Then, you only need to include this only file in your source file.Martí

2 Answers

2
votes

It can't be done, unfortunately.

The toctree directive has a glob option, which you would use like so:

.. toctree::
   :glob:

   generated/*

But this option is not available in the include directive.

Maybe start an issue for it?

0
votes

Perhaps indicate the start and end of the section where the files should go with a comment (.. START_GLOB_INCLUDE etc), and then have a build pre-process step that finds the files you want and rewrites that section of the master file.