Contents:
.. toctree:开发者_如何学编程:
:maxdepth: 2
foo.rst
bar.rst
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
I am trying to build it using sphinx-build . doc
It gives me warning:
(WARNING/2) toctree references unknown document u'bar'
What could be the reason?
Sphinx doesn't need the .rst
extension in the toctree directive. Assuming the toctree is in something like index.rst
and bar.rst
is in the same directory, try replacing foo.rst
and bar.rst
in your toctree directive with foo
and bar
respectively.
Otherwise, make sure bar.rst
is in the correct directory (and not in a parent or subdirectory).
I was also getting this error. For me, it was due to indentation. The "toctree" was indented by 3 space characters, whereas I listed the rst files by 4 space characters. To resolve the issue, we need to have the same indentation level.
精彩评论