关于 toctree 引用的警告

发布于 2024-10-07 13:44:37 字数 330 浏览 0 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

剧终人散尽 2024-10-14 13:44:37

Sphinx 不需要 toctree 指令中的 .rst 扩展名。假设目录树位于 index.rstbar.rst 位于同一目录中,请尝试替换 foo.rstbar.rst 在 toctree 指令中分别与 foobar 一起使用。

否则,请确保 bar.rst 位于正确的目录中(而不是位于父目录或子目录中)。

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).

童话里做英雄 2024-10-14 13:44:37

我也收到这个错误。对我来说,这是由于缩进。 “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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文