python-sphinx - 如何在 python-sphinx 中突出显示文本?

我正在寻找一种在 python sphinx 中突出显示文本的方法。 我看过有关如何更改单个单词的字体颜色的文档,但我想更改单个单词的背景颜色。

最佳答案

Sphinx 已经支持突出显示的文本 s5defs.txt standard definition file用于 inclusion (但缺少 CSS 文件):

  1. 创建/附加此文本到 rst_epilog 的值 sphinx 配置,在你的 docs/conf.py 文件中:

    rst_epilog = """
    .. include:: <s5defs.txt>
    """
    
  2. 关注Sphinx's instructions添加带有您喜欢的大纲的 CSS:

    • 将您的 css 文件放入例如_static/css/s4defs-roles.css;
    • 将其路径附加到 shtml_css_files 中狮身人面像配置:

      html_css_files = [
          'css/s4defs-roles.css',
      ]
      

然后您可以使用:

Some :outline:`outlined text` at last!

TIP: Read this SO if you also want the styling to appear in Latex output.

https://stackoverflow.com/questions/49210787/

相关文章:

java - 如何更改 azure-functions-maven-plugin 的日志记录级别?

python - 如何在 git post-receive hook 中指定 python 解释器?

android - 获取屏幕曲线、角和切口的物理形状

">javascript - 在 Firefox 中隐藏 <input type ="date">

react-native - react 导航 : stack navigator with tab

javascript - 子方法未定义 vue.js

tensorflow - 如何在 tensorflow playground 的第 4 个数据集上实

javascript - 错误类型错误 : Cannot read property 'tagNam

java - 强制执行以避免循环依赖

java - 运行时使用插件的不同库版本