python-sphinx - 警告 : document isn't included in any toctree for included file

标签 python-sphinx restructuredtext toctree

我收到警告:

WARNING: document isn't included in any toctree

适用于文档中存在的文件,因为它们已被明确包含。所以我有索引文件:

.. toctree::
    :maxdepth: 2

   pages/0010-foo
   pages/0020-bar

在文件 0020-bar.rst 中,我特别包含了许多其他文件,如下所示:

.. contents:: :local:

.. include:: /pages/reference-architecture/technical-considerations/0070-baz.rst

但是当我构建项目时,我仍然收到一条警告,提示 0070-baz.rst 不在任何目录树中,如下所示:

/home/nick/Documents/myProject/docs/pages/reference-architecture/technical-considerations/0070-baz.rst:: WARNING: document isn't included in any toctree

奇怪的是我可以看到输出中的内容。这是正常的吗?对于显式包含而不是通过 toctree 包含的文件,是否总是出现此警告?

最佳答案

如果您只想在另一个文档中 ..include:: 一个文档,而不让它出现在任何 toctree 中。

:orphan: 添加到文档顶部以消除警告。

这是一个文件范围元数据选项。阅读更多信息 Sphinx documentation .

关于python-sphinx - 警告 : document isn't included in any toctree for included file,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15249340/

相关文章:

conditional-statements - 狮身人面像中的有条件toctree

python - literalinclude : how to include only a variable using pyobject?

restructuredtext - 在 rst2html 生成的 HTML 输出中,各级部分都是类 "section",我可以配置它吗?

html - 更改 toctree 中标题文本的颜色

python-sphinx - 如何在Sphinx TOC中包含主页?

python - 狮身人面像/autodoc : how to cross-link to a function documented on another page

python - 狮身人面像 : link to an internal file declared as html_extra_path

python - Sphinx 文档常量替换

css - 使 CSS 按钮成为 Sphinx 中的链接

python-sphinx - 在 toctree 中添加 self 的子部分