Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to include a directory of files with RST and Sphinx

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?

like image 473
Aaron Avatar asked May 02 '16 23:05

Aaron


People also ask

What is Sphinx RST?

RST stands for ReStructured Text. It is the standard markup language used for documenting python packages. Sphinx is the Python package that generates an html website from RST files, and it is what we are using to generate this site.

How do you use a sphinx code block?

Literal code blocks (ref) are introduced by ending a paragraph with the special marker :: . The literal block must be indented (and, like all paragraphs, separated from the surrounding ones by blank lines): This is a normal text paragraph.

What is Maxdepth in Toctree?

toctree:: :maxdepth: 2 intro strings datatypes numeric (many more documents listed here) This accomplishes two things: Tables of contents from all those documents are inserted, with a maximum depth of two, that means one nested heading. toctree directives in those documents are also taken into account.


1 Answers

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?

like image 63
MERose Avatar answered Sep 17 '22 12:09

MERose