自定义sphinxdoc主题
有没有简单的方法可以自定义现有sphinxdoc
主题?对于默认主题,有很多主题属性,但是在sphinxdoc中,我什至无法设置徽标或更改某些颜色。
还是可以向我推荐一个可以学习如何修改主题的网站?
-
我只想在我的狮身人面像文档中添加ReST删除线。这是我的做法:
$ cd my-sphinx-dir $ mkdir -p theme/static $ touch theme/theme.conf $ touch theme/static/style.css
在
theme/theme.conf
:[theme] inherit = default stylesheet = style.css pygments_style = pygments.css
(这使其看起来像默认主题(图2))
在
theme/static/style.css
:@import url("default.css"); /* make sure to sync this with the base theme's css filename */ .strike { text-decoration: line-through; }
然后,在您的conf.py中:
html_theme = 'theme' # use the theme in subdir 'theme' html_theme_path = ['.'] # make sphinx search for themes in current dir
此处更多信息:https :
//sphinx.readthedocs.io/en/master/theming.html。(可选)在global.rst中:
.. role:: strike :class: strike
并在example.rst中:
.. include:: global.rst :strike:`This looks like it is outdated.`