| 1 |
======== |
| 2 |
Mermaid |
| 3 |
======== |
| 4 |
|
| 5 |
If you use `sphinxcontrib-mermaid <https://github.com/mgaitan/sphinxcontrib-mermaid>`_ |
| 6 |
to generate flowcharts or diagrams, and you output the diagrams in "raw" format, |
| 7 |
they will automatically adapt to this theme's light or dark mode. |
| 8 |
|
| 9 |
To use this feature, you'll need to install `sphinxcontrib-mermaid`_ and add it to your |
| 10 |
list of extensions in ``conf.py``: |
| 11 |
|
| 12 |
.. code-block:: python |
| 13 |
|
| 14 |
# conf.py |
| 15 |
extensions = [ |
| 16 |
..., |
| 17 |
"sphinxcontrib.mermaid", |
| 18 |
] |
| 19 |
|
| 20 |
This will enable the ``.. mermaid::`` directive. For example: |
| 21 |
|
| 22 |
.. begin-example-mermaid |
| 23 |
.. mermaid:: |
| 24 |
|
| 25 |
gitGraph: |
| 26 |
commit |
| 27 |
branch newbranch |
| 28 |
checkout newbranch |
| 29 |
commit id:"1111" |
| 30 |
commit tag:"test" |
| 31 |
checkout main |
| 32 |
commit type: HIGHLIGHT |
| 33 |
commit |
| 34 |
merge newbranch |
| 35 |
commit |
| 36 |
branch b2 |
| 37 |
commit |
| 38 |
.. end-example-mermaid |
| 39 |
|
| 40 |
is generated by the following code: |
| 41 |
|
| 42 |
.. include:: ./mermaid.rst |
| 43 |
:start-after: begin-example-mermaid |
| 44 |
:end-before: .. end-example-mermaid |
| 45 |
:code: rst |
| 46 |
:class: highlight |
| 47 |
|
| 48 |
See the `Mermaid documentation <https://mermaid.js.org/syntax/examples>`__ for additional examples. |