python - 如何将索引中的外部文件和部分包含到 sphinx 目录中?
问题描述
我正在使用 sphinx 构建我的 python 包文档,但是在将 docs 文件夹中其他文件的条目和 index.rst 上的其他部分中的条目添加到目录时遇到了一些麻烦。
这些是我的 docs 文件夹内容:
$ ls docs/
api_reference.rst _build conf.py index.rst make.bat Makefile _static _templates
这些是 index.rst 的第一行:
Welcome to SPIN's documentation!
================================
This is the Sorting Points Into Neighborhoods clustering method documentation.
.. toctree::
:maxdepth: 2
:caption: Contents:
:ref:`Introduction`
api_reference
.. _introduction:
Introduction
============
Sorting Points Into Neighborhoods, aka SPIN, is clustering
technique that only relies on the data and does not map any function on the
original space of the data points. :ref:`Introduction`
对介绍部分的第二个引用有效,但在 toctree 上的第一个无效。
如何将 api-reference 和介绍都添加到目录中?
解决方案
toctree
条目是文件名(带或不带文件扩展名)。交叉引用等:ref:`Introduction`
不起作用。
我建议您将介绍放在一个单独的文件中,并将文件名添加到toctree
.
推荐阅读
- c# - 使用ajax将值从MVC视图传递到控制器
- google-apps-script - 将数据从一个工作簿过滤到另一个工作簿和 Google 表格中第二个工作簿中的工作表
- maven - Maven 编译器插件 - 将参数发送到 javac(类路径或 cp)
- ms-access - 如何关闭特定字段的正确大小写更正?
- python - 使用 tkinter 和 schedule 模块制作“屏幕储物柜”
- c - 在 C 头文件原型中捕获缺少的分号
- reactjs - 设置了 headers 和 axios 但是为什么会发生 cros 错误?
- javascript - 如何编写一个具有类名并在 javascript 中返回字符串数组的函数?
- javascript - 使用对象键中的日期对结果进行分组,并且只计算结果
- python - 如何使用 Python Selenium 独立运行 Explorer