在 Sphinx 中防止下载链接中的粗体文本阅读文档

Preventing bold text in download links in Sphinx Read the Docs

在使用 Sphinx 和 RTD 主题记录 python 库期间,我 link 使用 :download: Download Text <_download/the_file.pdf> 角色下载了一些 PDF 文件,但由于某种原因,这导致了 link 看起来像:

下载文本

第一个字是正常的,但后面的字都是粗体。这很烦人。有没有办法停止下载 link 文本中第 2、3 等字的粗体字?

在这里回答我自己的问题...

我之前覆盖了主题样式,所以我在这里做了同样的事情。

我在 Sphinx 根目录的 _static 文件夹中添加了一个名为 theme_overrides.css 的 CSS 文件,其内容为:

/* override the bold words in download links */
@media screen and (min-width:767px) {

    .rst-content code.xref {
    /* !important prevents the common CSS stylesheets from overriding
         this as on RTD they are loaded after this stylesheet */
        font-weight: inherit !important;
    }
}

唯一让我担心的是,这可能会删除其他使用 .rst-content code.xref 样式的地方的粗体。但是到目前为止我还没有找到。

然后将以下内容添加到 Sphinx 设置的 conf.py 文件中:

html_context = {
    'css_files': [
        '_static/theme_overrides.css',  # override bold download text in RTD theme
        ],
     }

此解决方案的 http://rackerlabs.github.io/docs-rackspace/tools/rtd-tables.html 归功于 Rackspace 文档指南。