I'm looking for a way to highlight text in python sphinx. I have seen documentation on how to change the font colour of individual words, but I want to change the background colour of individual words.
Sphinx already supports highlighted text with the s5defs.txt standard definition file intended for inclusion (but is missing the CSS file):
Create/append this text to the value of rst_epilog
sphinx configuration, in your docs/conf.py file:
rst_epilog = """
.. include:: <s5defs.txt>
"""
Follow Sphinx's instructions to add a CSS with the outline you like:
_static/css/s4defs-roles.css;append it's path into shtml_css_files sphinx configuration:
html_css_files = [
'css/s4defs-roles.css',
]
You may then use:
Some :outline:`outlined text` at last!
TIP: Read this SO if you also want the styling to appear in Latex output.
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