PlantUML Example
There is a plugin for sphinx
called sphinxcontrib-plantuml
which adds support for embedding plantuml
into .rst
files so the generated HTML files will show beautiful UML diagrams.
One can achieve this by following these instructions:
Make sure
plantuml
is properly installed on your machine/environment, for instance it can be installed viaconda
like this:conda install -c conda-forge plantuml
Make sure you have the
sphinx
plugin forplantuml
(installable viapip
)pip install sphinxcontrib-plantuml
Make sure that this plugin would be recognized in your
conf.py
by adding it to theextentions
listNote
In this project the
conf.py
is generated bycmake
from theconf.py.in
file and therefore this addition should be added toconf.py.in
since it’s the template file for the generatedconf.py
.extentions = [ ... "sphinxcontrib.plantuml", ... ]
After those instructions you should be able to add the following directives in your .rst
files
.. uml::
@startuml
skinparam monochrome true
Alpha -> Bravo
Bravo -> Alpha
@enduml
Or if you prefer:
.. plantuml::
@startuml
skinparam monochrome true
Alpha -> Bravo
Bravo -> Alpha
@enduml
Here is how it looks (this is a very small sequence diagram)
Here is a far more complex class diagram :