关于 toctree 引用的警告
Contents:
.. toctree::
:maxdepth: 2
foo.rst
bar.rst
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
我正在尝试使用 sphinx-build 来构建它。 doc 它给了我警告:
(WARNING/2) toctree 引用未知文档 u'bar'
可能是什么原因?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Sphinx 不需要 toctree 指令中的
.rst
扩展名。假设目录树位于index.rst
和bar.rst
位于同一目录中,请尝试替换foo.rst
和bar.rst
在 toctree 指令中分别与foo
和bar
一起使用。否则,请确保 bar.rst 位于正确的目录中(而不是位于父目录或子目录中)。
Sphinx doesn't need the
.rst
extension in the toctree directive. Assuming the toctree is in something likeindex.rst
andbar.rst
is in the same directory, try replacingfoo.rst
andbar.rst
in your toctree directive withfoo
andbar
respectively.Otherwise, make sure
bar.rst
is in the correct directory (and not in a parent or subdirectory).我也收到这个错误。对我来说,这是由于缩进。 “toctree”缩进了 3 个空格字符,而我列出的第一个文件则缩进了 4 个空格字符。为了解决这个问题,我们需要有相同的缩进级别。
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.