【问题标题】:Use custom theme on ReadTheDocs在 ReadTheDocs 上使用自定义主题
【发布时间】:2017-08-25 09:59:53
【问题描述】:

我尝试使用继承自 Sphinx 内置 ReadTheDocs 主题的自定义主题。

当我在本地计算机上使用它时,我的设计很好。但是当我阅读文档版本(从 gi​​thub 导入)时,没有 CSS。

我错过了什么吗?

带有使用自定义主题的分支的 repo:https://github.com/DigitalSkills-fr/Docs/tree/custom_theme/docs

带有目标分支的 RTD 文档:http://digitalskills-docs.readthedocs.io/fr/custom_theme/index.html

【问题讨论】:

  • 寻求调试帮助的问题(“为什么这段代码不起作用?”)必须包括所需的行为、特定的问题或错误以及在问题本身中重现它所需的最短代码。没有明确问题陈述的问题对其他读者没有用处。请参阅:如何创建 minimal reproducible example。使用“编辑”链接改进您的问题 - 不要通过 cmets 添加更多信息。谢谢!

标签: python-sphinx read-the-docs


【解决方案1】:

您应该在 conf.py 中仅指定内置主题名称。

# The theme to use for HTML and HTML Help pages.  See the documentation for
# a list of builtin themes.
#html_theme = 'default'
html_theme = 'theme_digitalskills'

删除您的自定义条目并将原始条目恢复到:

html_theme = 'default'

假设您已修改分支 custom_theme 中的 CSS 文件,则 RTD 应复制 html_static_path 中指定的目录列表中的所有文件,覆盖内置主题的 CSS 文件:

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-08-07
    • 1970-01-01
    • 1970-01-01
    • 2020-01-23
    • 1970-01-01
    • 2014-01-15
    • 1970-01-01
    • 2019-12-16
    相关资源
    最近更新 更多