python – 自定义sphinxdoc主题
作者:互联网
有没有一种简单的方法来定制现有的sphinxdoc主题?对于默认主题,有许多主题属性,但在sphinxdoc中,我甚至无法设置徽标或更改某些颜色?
或者你能推荐一个我可以学习如何修改主题的网站吗?
解决方法:
我只想在我的sphinx doc中添加ReST strikethrough.我是这样做的:
$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
(这使它看起来像默认主题(l.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
在一个例子中:
.. include:: global.rst
:strike:`This looks like it is outdated.`
标签:python,themes,python-sphinx 来源: https://codeday.me/bug/20190923/1813314.html