我的笔记的 Sphinx 源位置 - 警告:文档不包含在任何目录树中

发布于 2024-08-10 19:25:48 字数 1455 浏览 11 评论 0原文

如何修复 Sphinx 底部的警告?

我正在尝试将我的 Python 笔记放入 Sphinx 中。 我的笔记位于与 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.

How can you fix the Sphinx's warning at the bottom?

I am trying to have my Python notes in Sphinx.
I have my notes in separate files at the same directory level as the index.rst.

I get the following warnings after building HTML

The warning

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

in

The complete message when building

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

原来是傀儡 2024-08-17 19:25:48

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

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

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


请实际阅读这个:http://sphinx.pocoo。 org/concepts.html#document-names

由于剩余源文件可以有
不同的扩展名(有些人喜欢
.txt,有些像 .rst – 扩展名
可以配置source_suffix)
并且不同的操作系统有不同的路径
分隔符,Sphinx 抽象它们:全部
“文档名称”是相对于
源目录,扩展名是
剥离,路径分隔符是
转换为斜杠。所有的价值观,
参数等参考
“文件”期望这样的文件
名称。

文档名称的示例为index
库/zip文件,或
参考/数据模型/类型。注意
没有前导斜杠。

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

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

Are you aware of Sphinx's documentation? https://www.sphinx-doc.org

Specifically, read about the toctree directive: https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#directive-toctree

You can have as many files as you want. Via toctree you can create a single document from many parts.


Please actually read this: 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.

Since you globbed with *, you do not need to list your files.

If you want to list your files, please actually read and follow the above rules.

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