【问题标题】:Preventing bold text in download links in Sphinx Read the Docs防止 Sphinx 下载链接中的粗体文本 阅读文档
【发布时间】:2017-03-21 21:52:45
【问题描述】:

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

下载文字

第一个单词是正常的,但后面的所有单词都是黑体字。这只是相当烦人。有没有办法停止下载链接文本中第 2、3 等字的粗体字?

【问题讨论】:

    标签: python python-sphinx read-the-docs


    【解决方案1】:

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

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

    我在 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 文档指南提供此解决方案。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-05-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-03-15
      • 1970-01-01
      • 2014-05-24
      相关资源
      最近更新 更多