python - Toctree 激活侧边栏上的当前页面和主页
问题描述
de上没有问题,index.rst
如下所示:
但是,当我转到另一个页面时,在我的情况下是annotation-module.rst
,侧边栏会选择并同时显示index
和annotation-module
,如下所示:
但是,我只想激活注释模块页面并显示其子部分。
我conf.py
唯一的用途html_theme
是通过查找READTHEDOCS
如下环境变量:
if not on_rtd: # only import and set the theme if we're building docs locally
try:
import sphinx_rtd_theme
html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
except Exception:
pass
我的index.rst
:
Welcome to exceptive's documentation!
=====================================
.. toctree::
:maxdepth: 2
:caption: Contents:
index
annotation-module
Here I have some introductory text.
annotation-module.rst
甚至不包括任何,我toctree
只有它下面的部分。
那么,如何仅激活侧边栏上的当前文档部分?
这是Steve Piercy要求的文档源目录。
环境
- 蟒蛇 3.5
- 狮身人面像 1.7.6
- 狮身人面像 rtd 主题 0.4.0
解决方案
所以,我有点解决了这个问题。问题出在sphinx-autobuild
某种程度上,我在问题中没有提到。
make html
每次我更新我的文档并使用node
's提供它时,我都会简单地使用它http-server
。
还引用index
inindex.rst
创建警告:
WARNING: self referenced toctree found. Ignored.
所以,index
从toctree
现在解决我的问题。
推荐阅读
- dll - libxml2 依赖项,但是当程序启动时,它要求使用 mingw32 编译的 libxml2-2
- automation - 开发人员调查,估计架构师/开发人员设置基本软件架构、系统安全和集成所花费的时间
- sql - SQL 代码仅获取平均价值高于所有产品的全球平均价格的产品
- rust - 如何在 Rust 中使用 cargo-raze 为 Bazel 生成包 BUILD 文件?
- javascript - 如何停止执行直到函数完成
- python - 将 Python 函数脚本导入另一个 Python 文件?
- typescript - 我们如何在 pulumi 中仅使用多个 kubernetes 配置中的 1 个配置
- c - 编译 C 程序时出错,但此代码在其他计算机上工作
- python - 设计一个显示以下菜单的程序: 选择一种语言,我会说早安 1. 英语 2. 意大利语 3. 西班牙语 4. 德语 5
- javascript - 如何在运行时将条目添加到下拉列表?