6. Sphinx 扩展模块#
更新时间: 2021-12-21, 11:46:56 | Sphinx 版本:{{sphinx}} | markdown-it-py 版本:{{markdown_it_py}}
Sphinx 插件还有
原生插件
和非原生插件之分,原生插件的命名格式以 sphinx.ext.
开头,
否则就是非原生插件(前提它是 Sphinx 插件),所有 Sphinx 插件都是需要在
conf.py
中被配置的。
对于原生插件,它是不需要在 requirements
相关文件中添加的,
需要添加到在 requirements [1] 相关文件的插件是那些非原生插件。
直接在 conf.py
文件中的 extensions
数组中添加插件名字符串后,然后添加一些其他配置代码的情况下即可直接生效。
例如 sphinx_copybutton
插件:
# In your conf.py configuration file, add sphinx_copybutton to your extensions list. E.g.:
extensions = [
...
'sphinx_copybutton'
...
]
#若要定义要从代码块中复制的文本中删除的提示文本
copybutton_prompt_text = "myinputprompt"
:maxdepth: 2
响应式 Web 组件的 Sphinx 扩展—— Sphinx Design <design/design-index>
下拉框按钮—— sphinx-togglebutton <togglebutton>
选项卡工具—— Sphinx tabs <./tab>
实时重新加载 Sphinx 文档 <./autobuild>
RST-to-MyST 转换工具 <rst-to-myst>
自动生成的标题锚点工具 <autosectionlabel>
提供了对 TODO 项的支持 <todo>