Mermaid#

If you use sphinxcontrib-mermaid to generate flowcharts or diagrams, and you output the diagrams in “raw” format, they will automatically adapt to this theme’s light or dark mode.

To use this feature, you’ll need to install sphinxcontrib-mermaid and add it to your list of extensions in conf.py:

# conf.py
extensions = [
    ...,
    "sphinxcontrib.mermaid",
]

This will enable the .. mermaid:: directive. For example:

        gitGraph:
    commit
    branch newbranch
    checkout newbranch
    commit id:"1111"
    commit tag:"test"
    checkout main
    commit type: HIGHLIGHT
    commit
    merge newbranch
    commit
    branch b2
    commit
    

is generated by the following code:

.. mermaid::

    gitGraph:
        commit
        branch newbranch
        checkout newbranch
        commit id:"1111"
        commit tag:"test"
        checkout main
        commit type: HIGHLIGHT
        commit
        merge newbranch
        commit
        branch b2
        commit

See the Mermaid documentation for additional examples.