asciidoctor / asciidoctor-kroki

Asciidoctor.js extension to convert diagrams to images using Kroki!

Home Page:https://kroki.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support view attribute for Structurizr docs rendered with Kroki

timw opened this issue · comments

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.

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.

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").