pythonpython-sphinxtoctree

Sphinx: modules.rst: WARNING: document isn't included in any toctree


Trying to generate documentation with Sphinx.

First using: sphinx-apidoc Then using: sphinx-build html

And I got this warning about the modules.rst file. The file exists, the html is also generated, it definitely looks like a table of content.

I read every topic I could find about the subject, none solve the issue (correct positioning of the modules declation in the index.rst file, using the .. include:: directive...)

I do not know what to do to make it work

Here is a copy of my index.rst file, maybe you'll see something that I do not. The generated rst files are located in the sources folder

Welcome to documentation!
=====================================
    
.. toctree::
   :maxdepth: 4
   :caption: Contents:

   modules

   
Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

I also get this message:

..\doc\sphinx\index.rst:4: WARNING: toctree contains reference to nonexisting document u'modules'

If I replace modules by another document, I get the following:

\doc\sphinx\index.rst:4: WARNING: toctree contains reference to nonexisting document u'opsimtest'
looking for now-outdated files... none found
pickling environment... done
checking consistency... \doc\sphinx\_apidocs\modules.rst: WARNING: document isn't included in any toctree

So it looks like even if I name another document in the toctree, it's still looking for modules.rst (and does not see the other document, which was however built into a html file)

In this topic: Can't get sphinx to link under toctree to another document the error message states intro.rst instead of modules.rst. Edit: As I told, I unfortunately already read the others threads and they did not solve my issue. It's still broken.


Solution

  • In reST white space has meaning. The directive and its options must be separated from its content with a blank line.

    .. toctree::
        :maxdepth: 4
        :caption: Contents:
    
        _apidocs/modules