我正在寻找一种在python sphinx中突出显示文字的方法。 我看过有关如何更改单个单词的字体颜色的文档,但我想更改单个单词的背景颜色。
答案 0 :(得分:0)
Sphinx 已支持突出显示的文本,其中s5defs.txt
standard definition file用于inclusion(但缺少CSS文件):
创建此文本/将其添加到rst_epilog
的值
sphinx配置,在您的docs/conf.py
文件中:
rst_epilog = """
.. include:: <s5defs.txt>
"""
按照Sphinx's instructions添加具有您喜欢的 outline 的CSS:
_static/css/s4defs-roles.css
; 将其路径附加到shtml_css_files
sphinx配置中:
html_css_files = [
'css/s4defs-roles.css',
]
然后您可以使用:
Some :outline:`outlined text` at last!
提示: 如果您还希望样式显示在 Latex 输出中,请阅读this SO。