In VS Code as an Integrated, Extensible Authoring Environment for Rich Media Asset Creation, I linked to a rather magical VS Code extension (shd101wyy.markdown-preview-enhanced) that lets you preview diagrams rendered from various diagram scripts, such as documents defined using Mermaid markdown script or wavedrom.
The diagram script is incorporated in code fenced block qualified by the scripting language type, such as
Pondering whether I this was also a route to live previews of documents rendered from the original markdown using Sphinx (the publishing engine used in Jupyter Book workflows, for example), I had a poke around for related extensions and found a couple of likely candidates, such as:
After installing the packages from PyPi, these extensions are enabled in a Jupyter Book workflow by adding the following to the
sphinx: extra_extensions: - sphinxcontrib.mermaid - sphinxcontrib.wavedrom
Building a Sphinx generated book from a set of markdown files using Jupyter Book (e.g. by running
jupyter-book build .) does not render the diagrams… Boo…
However, changing the code fence label to a MyST style label (as suggested here), does render the diagrams in the Sphinx generated Jupyter Book output, albeit at the cost of not now being able to preview the diagram directly in the VS Code editor.
It’s not so much of an overhead to flip between the two, and an automation step could probably be set up quite straightforwardly to convert between the forms as part of a publishing workflow, but I’ve raised an issue anyway suggesting it might be nice if the shd101wyy.markdown-preview-enhanced extension also supported the MyST flavoured syntax…