16. Diagrams#
Using Mermaid.js and sphinxcontrib-mermaid, one can create diagrams like the one below.
There are some limitations to mermaid.js, for example one cannot always align nodes or position them in specific places.
Below is a quick attempt at reproducing Figure 1.2 from optimisation-notes.pdf that highlights some of the shortcomings.
The math may not be rendering above, see Broken math and PDFs for Mermaid.js diagrams.
One can change the aesthetic attributes of the diagram elements, the above one contains examples of doing that within the diagram specification itself.
One can also create a theme and set it either for a specific diagram or make it the default option for all diagrams.
However, doing the former right now requires a workaround (example here), and I’m not sure if the latter will work all the time (for example when mmdc is involved).
16.1. Further reading#
Alternative diagram tools for Jupyter-Book here
Graphviz seems to have a native extension for Sphinx