✍️ Markup#
Note
Sphinx supports two markup languages for writing documentation:
reStructuredText (RST) - Sphinx’s native markup language
MyST Markdown - Markdown with Sphinx extensions
This page documents theme-specific classes and options that extend the standard markup.
Theme visibility#
Show or hide content based on the active theme. See Light and dark mode for more details on theme configuration.
Class |
Description |
|---|---|
|
Only visible in light mode |
|
Only visible in dark mode |
|
Inverts colors in light mode |
|
Inverts colors in dark mode |
Show/Hide example#
Display different images for each theme:
```{image} logo-light.png
:class: only-light
```
```{image} logo-dark.png
:class: only-dark
```
.. image:: logo-light.png
:class: only-light
.. image:: logo-dark.png
:class: only-dark
Invert example#
Automatically invert an image’s colors based on the theme. Useful for simple graphics, diagrams, or logos that work well when inverted.
```{image} diagram.png
:class: invert-dark
```
.. image:: diagram.png
:class: invert-dark
Demo: This image inverts in dark mode (toggle theme to see the effect):