在 ReadTheDocs 上使用自定义主题

Use custom theme on ReadTheDocs

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

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

我是不是漏掉了什么?

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

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

您应该在 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']