structurizr / export

Export models and views to external formats.

Home Page:https://docs.structurizr.com/export

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support for skinparam svgLinkTarget for C4PlantUML Exporter

qtzar opened this issue · comments

Description

By default the PlantUML SVG export set target="_top" for all links in the SVG export which is causing issues when trying to embed exported SVGs in an iFrame. Clicking links in the SVG causes the page to break out of the iFrame.

PlantUML has an option for skinparam svgLinkTarget x where x is a user supplied value like _self or a user supplied iFrame ID which will change the default link target used in the sag export.

I would love if an option could be added to support adding/changing this default.

Priority

Low

Resolution

I'm willing to add this feature myself and raise a PR

More information

No response

If you're using the exporter directly (i.e. not via the Structurizr CLI), you can add a skinparam as follows:

C4PlantUMLExporter exporter = new C4PlantUMLExporter();
exporter.addSkinParam("svgLinkTarget", "_self");

Thanks for the info. If there is value in adding this as a configurable property in the views properties section of the DSL then I'll be happy to do a PR for it, if not then the issue can be closed.

I don't think there's much value in having a specific setting for svgLinkTarget, but perhaps being able to set skinparams (e.g. via plantuml.skinparams) might be useful. That said, plantuml.includes can be used to include a file that defines any additional skinparams. Your choice.