Mermaid Example
There is a plugin for sphinx called sphinxcontrib-mermaid which adds support for embedding Mermaid graphs
in your documents, including general flowcharts, sequence diagrams, gantt diagrams and more. One can achieve this by following these instructions:
Make sure you have the
sphinxplugin formermaid(installable viapip)pip install sphinxcontrib-mermaid
Make sure that this plugin would be recognized in your
conf.pyby adding it to theextentionslistNote
In this project the
conf.pyis generated bycmakefrom theconf.py.infile and therefore this addition should be added toconf.py.insince it’s the template file for the generatedconf.py.extentions = [ ... "sphinxcontrib.mermaid", ... ]
After those instructions you should be able to add the following directives in your .rst files
.. mermaid::
sequenceDiagram
participant Alice
participant Bob
Alice->John: Hello John, how are you?
loop Healthcheck
John->John: Fight against hypochondria
end
Note right of John: Rational thoughts <br/>prevail...
John-->Alice: Great!
John->Bob: How about you?
Bob-->John: Jolly good!
Here is how it looks (this is a very small sequence diagram)
sequenceDiagram
participant Alice
participant Bob
Alice->John: Hello John, how are you?
loop Healthcheck
John->John: Fight against hypochondria
end
Note right of John: Rational thoughts <br/>prevail...
John-->Alice: Great!
John->Bob: How about you?
Bob-->John: Jolly good!