Is there an easy way to customize the existing sphinxdoc
theme? For the default theme, there are many theme-attributes, but in sphinxdoc I can't even set a logo or change some colors.
Or can you recommend me a site where I can learn how to modify themes?
All I wanted is to add ReST strikethrough in my sphinx doc. Here is how I did it:
$ cd my-sphinx-dir
$ mkdir -p theme/static
$ touch theme/theme.conf
$ touch theme/static/style.css
In theme/theme.conf
:
[theme]
inherit = default
stylesheet = style.css
pygments_style = pygments.css
(this makes it look like the default theme (l. 2))
In 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;
}
Then, in your conf.py:
html_theme = 'theme' # use the theme in subdir 'theme'
html_theme_path = ['.'] # make sphinx search for themes in current dir
More here: https://sphinx.readthedocs.io/en/master/theming.html.
(Optional) In global.rst:
.. role:: strike
:class: strike
and in a example.rst:
.. include:: global.rst
:strike:`This looks like it is outdated.`
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With