asciidoctor-diagram
asciidoctor-diagram copied to clipboard
Add support for Structurizr workspaces
Add a means to add a rendered version of a single view of a Structurizr workspace. This can be implemented by using structurizr-cli to generate PlantUML-C4 and then pass that on to PlantUML.
Possible syntax:
structurizr::<workspace file>[view=<view>]
Block support is easy enough to add as well, but might not make much sense since there wouldn't be a way to share the workspace between multiple blocks easily. Maybe for simple, single view workspaces, but you probably wouldn't be using C4 then.
If it helps, here's a very basic (and naive) starting point that I used as a proof of concept for a pre-processor -> https://gist.github.com/simonbrowndotje/4b6c000f42ff1607d8f9c4add3414f1f
Thanks @simonbrowndotje. I implemented that portion in the java support code for this extension (see https://github.com/asciidoctor/asciidoctor-diagram-java/blob/master/structurizr/src/main/java/org/asciidoctor/diagram/structurizr/Structurizr.java).
asciidoctor-diagram spins up a little helper daemon for all things Java to avoid the JVM startup cost for each diagram in a document. That's what this is. Needs a bit more tweaking, but it already gives a good idea of where this is heading.
On the Structurizr side of things it would be useful to have a method to get all views from a ViewSet
and a way to export any View
. I saw that you did this by converting the entire workspace and then finding the correct Diagram
. That works too, but seemed a bit wasteful. The extension would end up converting the entire workspace for every single rendered view.
A first version of Structurizr DSL support has been added. For now the only support path is via PlantUML-C4. Extending this to support the other exporters (Mermaid, vanilla PlantUML, and GraphViz) should be pretty straightforward.
I wasn't comfortable repacking the set of Structurizr CLI jar files in a gem in the same way that PlantUML and Ditaa are repackaged, so for now people will have to download a Structurizr CLI release and point to it by setting the DIAGRAM_STRUCTURIZRCLI_HOME
environment variable.