python-sphinx - Sphinx toctree 指令:如何隐藏标题不被显示?
问题描述
如果我有以下内容index.rst
:
This Section
------------
.. toctree::
:caption: This Section
:maxdepth: 1
this_section/intro
this_section/body
this_section/outro
然后“本节”将在生成的 HTML 文件中出现两次:一个是<h1>
,一个是<p class="caption">
. 我怎样才能摆脱后者,或者:caption:
生成一个<h1>
?我不能简单地删除:caption:
,因为侧边栏(我正在使用 ReadTheDoc 主题)依赖此选项来正确生成 TOC 树。
解决方案
我最终通过将其添加到目录中来使用 css 删除custom.css
它_static
:
section#setup span.caption-text {
display: none;
}
并在我的conf.py
:
html_static_path = ['_static']
html_css_files = ['custom.css']
推荐阅读
- angular - 角度图像404后备
- sql - 在选择中使用函数中的行类型 - PL SQL
- ffmpeg - 用于为音频 aac 创建 DASH 和 HLS 播放列表的打包工具
- javascript - 重构 map 函数,以便返回一个字符串
- angular - 我想在 Angular 项目中设置主题
- javascript - 如何解决 npm 包中的“无法解析模块说明符”错误?
- pycharm - 如何将我的所有 python 库从一台机器转移到另一台机器
- java - 隐藏/显示 Recyclerview 的行有效,但需要太多时间
- firebase - Flutter Web 不验证在 Flutter App 上创建的用户,反之亦然
- python - 如何使用标准 django 过滤器访问加入“中间”表?