Following on from Previewing Sphinx and Jupyter Book Rendered Mermaid and Wavedrom Diagrams in VS Code, I note several more sphinx extensions for rendering diagrams from source script in appropriately tagged code fenced blocks:
blockdiag/sphinxcontrib-blockdiag
: a rather dated, but still working, extension, that generates png images from source scripts. (The resolution of the text in the image is very poor. It would perhaps be useful to be able to specify outputting SVG?) See also this Jupyter notebook renderer extension:innovationOUtside/ipython_magic_blockdiag
. I haven’t spotted a VS Code preview extension for blockdiag yet. Maybe this is something I should try to build for myself? Maybe a strike day activity for me when the strikes return…sphinx-contrib/plantuml
: I have’t really looked at PlantUML before, but it looks like it can generate a whole host of diagram types, including sequence diagrams, activity diagrams, state diagrams, deployment diagrams, timing diagrams, network diagrams, wireframes and more.
The jbn/IPlantUML
IPython extension and the markdown-preview-enhanced
VS Code extension will also preview PlantUML diagrams in Jupyter notebooks and VS Code respectively. For example, in a Jupyter notebook we can render a PlantUML sequence diagram via a block magicked code cell.
sphinx-contrib/tikz
: for rendering the full goodness of LaTeXtikz
diagrams, assuming you have access to an appropriate LaTeX processing enviornment. See also this Jupyter notebook renderer extension:innovationOUtside/ipython_magic_tikz
.
UPDATE April ’22: here’s another, sphinx-contrib/svgbob
: render ascii art to SVG using svgbob
:
This is also supported in JupyterLab markdown cells (albeit using the bob
fence label) via the agoose77/jupyterlab-markup/
extension [UPDATE: diagrams have been split out as requirements into the agoose77/markdown-it-mermaid
and agoose77/markdown-it-svgbob
packages; the svgbob tag has also been brought in line with the sphinx extension]. (In VS Code, the markdown-preview-enhanced
extension can render ascii art using ditaa
.)