asciidoctor / asciidoctor-kroki

Asciidoctor.js extension to convert diagrams to images using Kroki!
https://kroki.io/
MIT License
146 stars 47 forks source link

Support view attribute for Structurizr docs rendered with Kroki #418

Open timw opened 1 year ago

timw commented 1 year ago

Using asciidoctor-vscode to render Asciidoc with Structurizr diagrams containing multiple views, only the last view defined in the Structurizr diagram is rendered in the preview.

With a large Structurizr workspace (which might commonly be managed in an external file to the Asciidoc) there will be many views, so these aren't rendered correctly in the preview.

Asciidoctor-diagram defines the view attribute 1 for specifying the view to render. Kroki defines the view-key option 2 to specify the view to render for Structurizr inputs.

It would be great if the renderer could map the standard view attribute on the diagram block to the Kroki view-key option so these diagrams are rendered correctly in previews.

jrauschenbusch commented 3 months ago

I made it with this in my Antora project:

structurizr::example$system.dsl[renderer="mermaid",view-key="Containers"]

view-key is of course not the property specified for AsciiDoctor Diagram, but it works for me. Kroki now get's the query param it expects.

ggrossetie commented 2 months ago

I guess Kroki (server) could support both. Not sure if it's better to convert view to view-key in the extension or support both options in Kroki... 🤔

I guess view-key should have a higher precedence (since it's the "long-form").