python - 我的笔记的 Sphinx 源位置 - 警告 : document isn't included in any toctree

标签 python python-sphinx glob toctree

如何修复底部狮身人面像的警告?

我正在尝试在 Sphinx 中保存我的 Python 笔记。 我的笔记位于与 index.rst 相同目录级别的单独文件中。

构建 HTML 后,我收到以下警告

警告

/home/heo/S_codes/trig_functions.rst:: WARNING: document isn't included in any toctree

构建时的完整消息

sudo sphinx-build -b html ./ _build/html
Running Sphinx v0.6.2
loading pickled environment... done
building [html]: targets for 0 source files that are out of date
updating environment: 1 added, 2 changed, 0 removed
reading sources... [100%] trig_functions
/home/heo/S_codes/databooklet.rst:1: (WARNING/2) malformed hyperlink target.
/home/heo/S_codes/index.rst:11: (ERROR/3) Error in "toctree" directive:
invalid option block.

.. toctree::
   :numbered:
   :glob:
   *
   databooklet.rst
   trig_functions.rst


/home/heo/S_codes/trig_functions.rst:11: (ERROR/3) Unexpected indentation.
looking for now-outdated files... none found
pickling environment... done
checking consistency... /home/heo/S_codes/databooklet.rst:: WARNING: document isn't included in any toctree
/home/heo/S_codes/trig_functions.rst:: WARNING: document isn't included in any toctree
done
preparing documents... done
writing output... [100%] trig_functions
writing additional files... genindex search
copying static files... done
dumping search index... done
dumping object inventory... done
build succeeded, 6 warnings.

最佳答案

您了解 Sphinx 的文档吗? https://www.sphinx-doc.org

具体来说,请阅读 toctree 指令:https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#directive-toctree

您可以拥有任意数量的文件。通过toctree,您可以从多个部分创建一个文档。


请实际阅读此内容:http://sphinx.pocoo.org/concepts.html#document-names

Since the reST source files can have different extensions (some people like .txt, some like .rst – the extension can be configured with source_suffix) and different OSes have different path separators, Sphinx abstracts them: all “document names” are relative to the source directory, the extension is stripped, and path separators are converted to slashes. All values, parameters and suchlike referring to “documents” expect such a document name.

Examples for document names are index, library/zipfile, or reference/datamodel/types. Note that there is no leading slash.

由于您使用 * 进行了通配,因此您无需列出文件。

如果您想列出您的文件,请实际阅读遵循上述规则。

关于python - 我的笔记的 Sphinx 源位置 - 警告 : document isn't included in any toctree,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1690757/

相关文章:

Python - 连接特定目录中的 CSV 文件

angular - 使用 glob 定位任何具有特定前缀的嵌套文件夹

python - 在没有嵌套 for 循环的情况下在 Python 中明智地连接两个字符串列表

python - asyncio.wait_for 不会传播 CancelledError,如果在取消之前等待 future 为 "done"

python - 如何将自定义 css 文件添加到 Sphinx?

python - 狮身人面像 : internal short reference to python class

gulp - ** 全局字符是什么?

php glob模式匹配任意数字

python - 仅在对象实例的生命周期内保持 Python 解释器事件

python-sphinx - 使用 Read The Docs & Sphinx 和 ReadTheDocs 主题时删除在 Github 上的编辑链接