-
-
Notifications
You must be signed in to change notification settings - Fork 225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for diagrams.net (draw.io) #405
Comments
I took a look at https://github.com/jgraph/drawio and here's my report:
Since diagrams.net CLI is relatively fast (and will require less maintenance), I think we should either install it as part of For reference, @rlespinasse did some work to provide diagrams.net CLI as a Docker image: https://github.com/rlespinasse/docker-drawio-desktop-headless |
Hi, |
We are waiting for an upstream change to be able to integrate it cleanly: jgraph/drawio#1946 You can vote for this issue, maybe it will get some attention. |
just saw this container which might help create a solution: https://hub.docker.com/r/tomkludy/drawio-renderer it seems that the draw.io CLI has a huge number of dependencies which are all resolved in the container image. |
Seems like you got an answer there, did you have a look? |
Yes, I have a working prototype but still a lot of work is needed to ensure a smooth integration. |
@deusama @Mogztter this is an interesting blog post which gives another rendering option: Truly headless draw.io exports. We could use Kroki's draw.io renderer and would love to try it out when it's ready. Thanks for the great work @Mogztter! |
@Mogztter in case you haven't seen the FAQ and as reference: https://www.diagrams.net/doc/faq/svg-export-text-problems |
Interesting, I didn't know you could disable complex HTML labels (
I guess, in my configuration,
That's a solution but it's costly. I don't think Kroki should export to PDF then use inkscape (CLI) to convert it to SVG. That would probably be too much (at least for the first iteration). Anyway, we should definitely keep this link and add it in the Kroki documentation once we add support for diagrams.net. |
Following up on this one - do you think it makes sense to add drawio support with a In that case what would be the strategy to add it to kroki at that stage - your approach with headless exports seems promising. |
There is a command line tool to render drawio https://j2r2b.github.io/2019/08/06/drawio-cli.html The ability to support draw.io would really increase the usability of AsciiDoc and therefore potentially increase the user base of the Kroki plugin collection |
Experimental support will land on the next release. diagrams.net will be available as a companion container ( |
Great feature! |
I tried it.
<mxfile host="Electron" modified="2022-03-26T10:52:07.381Z" agent="5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/17.2.1 Chrome/96.0.4664.174 Electron/16.1.0 Safari/537.36" etag="c7rPkDjiJFuVDdgIdBCQ" version="17.2.1" type="device">
<diagram id="is4nKnoC7knK3tbmEpOL" name="ページ1">
<mxGraphModel dx="1102" dy="857" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<object placeholders="1" c4Name="Banking Customer" c4Type="Person" c4Description="A customer of the bank, 
with personal bank accounts." label="<font style="font-size: 16px"><b>%c4Name%</b></font><div>[%c4Type%]</div><br><div><font style="font-size: 11px"><font color="#cccccc">%c4Description%</font></div>" id="v1w6xJLIwrtz22bP0FQ9-1">
<mxCell style="html=1;fontSize=11;dashed=0;whitespace=wrap;fillColor=#083F75;strokeColor=#06315C;fontColor=#ffffff;shape=mxgraph.c4.person2;align=center;metaEdit=1;points=[[0.5,0,0],[1,0.5,0],[1,0.75,0],[0.75,1,0],[0.5,1,0],[0.25,1,0],[0,0.75,0],[0,0.5,0]];resizable=0;" parent="1" vertex="1">
<mxGeometry x="260" y="40" width="200" height="180" as="geometry" />
</mxCell>
</object>
<mxCell id="v1w6xJLIwrtz22bP0FQ9-2" value="Legend" style="align=left;fontSize=16;fontStyle=1;strokeColor=none;fillColor=none;fontColor=#4D4D4D;spacingTop=-8;resizable=0;" parent="1" vertex="1">
<mxGeometry x="40" y="10" width="180" height="30" as="geometry" />
</mxCell>
<mxCell id="v1w6xJLIwrtz22bP0FQ9-3" value="" style="shape=table;html=1;whiteSpace=wrap;startSize=0;container=1;collapsible=0;childLayout=tableLayout;fillColor=none;align=left;spacingLeft=10;strokeColor=none;rounded=1;arcSize=11;fontColor=#FFFFFF;resizable=0;points=[[0.25,0,0],[0.5,0,0],[0.75,0,0],[1,0.25,0],[1,0.5,0],[1,0.75,0],[0.75,1,0],[0.5,1,0],[0.25,1,0],[0,0.75,0],[0,0.5,0],[0,0.25,0]];" parent="1" vertex="1">
<mxGeometry x="40" y="40" width="180" height="180" as="geometry" />
</mxCell>
<mxCell id="v1w6xJLIwrtz22bP0FQ9-4" value="Person" style="shape=partialRectangle;html=1;whiteSpace=wrap;connectable=0;fillColor=#1E4074;top=0;left=0;bottom=0;right=0;overflow=hidden;pointerEvents=1;align=left;spacingLeft=10;strokeColor=none;fontColor=#FFFFFF;" parent="v1w6xJLIwrtz22bP0FQ9-3" vertex="1">
<mxGeometry width="180" height="30" as="geometry" />
</mxCell>
<mxCell id="v1w6xJLIwrtz22bP0FQ9-5" value="Software System" style="shape=partialRectangle;html=1;whiteSpace=wrap;connectable=0;fillColor=#3162AF;top=0;left=0;bottom=0;right=0;overflow=hidden;pointerEvents=1;align=left;spacingLeft=10;fontColor=#FFFFFF;" parent="v1w6xJLIwrtz22bP0FQ9-3" vertex="1">
<mxGeometry y="30" width="180" height="30" as="geometry" />
</mxCell>
<mxCell id="v1w6xJLIwrtz22bP0FQ9-6" value="Container" style="shape=partialRectangle;html=1;whiteSpace=wrap;connectable=0;fillColor=#52A2D8;top=0;left=0;bottom=0;right=0;overflow=hidden;pointerEvents=1;align=left;spacingLeft=10;fontColor=#FFFFFF;" parent="v1w6xJLIwrtz22bP0FQ9-3" vertex="1">
<mxGeometry y="60" width="180" height="30" as="geometry" />
</mxCell>
<mxCell id="v1w6xJLIwrtz22bP0FQ9-7" value="Component" style="shape=partialRectangle;html=1;whiteSpace=wrap;connectable=0;fillColor=#7CBEF1;top=0;left=0;bottom=0;right=0;overflow=hidden;pointerEvents=1;align=left;spacingLeft=10;fontColor=#FFFFFF;" parent="v1w6xJLIwrtz22bP0FQ9-3" vertex="1">
<mxGeometry y="90" width="180" height="30" as="geometry" />
</mxCell>
<mxCell id="v1w6xJLIwrtz22bP0FQ9-8" value="External Person" style="shape=partialRectangle;html=1;whiteSpace=wrap;connectable=0;fillColor=#6B6477;top=0;left=0;bottom=0;right=0;overflow=hidden;pointerEvents=1;align=left;spacingLeft=10;fontColor=#FFFFFF;" parent="v1w6xJLIwrtz22bP0FQ9-3" vertex="1">
<mxGeometry y="120" width="180" height="30" as="geometry" />
</mxCell>
<mxCell id="v1w6xJLIwrtz22bP0FQ9-9" value="External Software System" style="shape=partialRectangle;html=1;whiteSpace=wrap;connectable=0;fillColor=#8B8496;top=0;left=0;bottom=0;right=0;overflow=hidden;pointerEvents=1;align=left;spacingLeft=10;fontColor=#FFFFFF;" parent="v1w6xJLIwrtz22bP0FQ9-3" vertex="1">
<mxGeometry y="150" width="180" height="30" as="geometry" />
</mxCell>
<object placeholders="1" c4Name="System name" c4Type="Software System" c4Description="Description of software system." label="<font style="font-size: 16px"><b>%c4Name%</b></font><div>[%c4Type%]</div><br><div><font style="font-size: 11px"><font color="#cccccc">%c4Description%</font></div>" id="v1w6xJLIwrtz22bP0FQ9-13">
<mxCell style="rounded=1;whiteSpace=wrap;html=1;labelBackgroundColor=none;fillColor=#1061B0;fontColor=#ffffff;align=center;arcSize=10;strokeColor=#0D5091;metaEdit=1;resizable=0;points=[[0.25,0,0],[0.5,0,0],[0.75,0,0],[1,0.25,0],[1,0.5,0],[1,0.75,0],[0.75,1,0],[0.5,1,0],[0.25,1,0],[0,0.75,0],[0,0.5,0],[0,0.25,0]];" parent="1" vertex="1">
<mxGeometry x="40" y="280" width="240" height="120" as="geometry" />
</mxCell>
</object>
<object placeholders="1" c4Name="External system name" c4Type="Software System" c4Description="The internal Microsoft
Exchange e-mail system." label="<font style="font-size: 16px"><b>%c4Name%</b></font><div>[%c4Type%]</div><br><div><font style="font-size: 11px"><font color="#cccccc">%c4Description%</font></div>" id="v1w6xJLIwrtz22bP0FQ9-14">
<mxCell style="rounded=1;whiteSpace=wrap;html=1;labelBackgroundColor=none;fillColor=#8C8496;fontColor=#ffffff;align=center;arcSize=10;strokeColor=#736782;metaEdit=1;resizable=0;points=[[0.25,0,0],[0.5,0,0],[0.75,0,0],[1,0.25,0],[1,0.5,0],[1,0.75,0],[0.75,1,0],[0.5,1,0],[0.25,1,0],[0,0.75,0],[0,0.5,0],[0,0.25,0]];" parent="1" vertex="1">
<mxGeometry x="440" y="280" width="240" height="120" as="geometry" />
</mxCell>
</object>
<object placeholders="1" c4Type="Relationship" c4Description="Uses" label="<div style="text-align: left"><div style="text-align: center"><b>%c4Description%</b></div>" id="v1w6xJLIwrtz22bP0FQ9-15">
<mxCell style="endArrow=blockThin;html=1;fontSize=10;fontColor=#404040;strokeWidth=1;endFill=1;strokeColor=#828282;elbow=vertical;metaEdit=1;endSize=14;startSize=14;jumpStyle=arc;jumpSize=16;rounded=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;exitPerimeter=0;entryX=0.75;entryY=0;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="v1w6xJLIwrtz22bP0FQ9-1" target="v1w6xJLIwrtz22bP0FQ9-13" edge="1">
<mxGeometry width="240" relative="1" as="geometry">
<mxPoint x="30" y="520" as="sourcePoint" />
<mxPoint x="270" y="520" as="targetPoint" />
</mxGeometry>
</mxCell>
</object>
<object placeholders="1" c4Type="Relationship" c4Description="Sends e-mails to" label="<div style="text-align: left"><div style="text-align: center"><b>%c4Description%</b></div>" id="v1w6xJLIwrtz22bP0FQ9-16">
<mxCell style="endArrow=blockThin;html=1;fontSize=10;fontColor=#404040;strokeWidth=1;endFill=1;strokeColor=#828282;elbow=vertical;metaEdit=1;endSize=14;startSize=14;jumpStyle=arc;jumpSize=16;rounded=0;exitX=0.25;exitY=0;exitDx=0;exitDy=0;exitPerimeter=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="v1w6xJLIwrtz22bP0FQ9-14" target="v1w6xJLIwrtz22bP0FQ9-1" edge="1">
<mxGeometry width="240" relative="1" as="geometry">
<mxPoint x="310" y="230" as="sourcePoint" />
<mxPoint x="300" y="220" as="targetPoint" />
</mxGeometry>
</mxCell>
</object>
<object placeholders="1" c4Name="Mainframe Banking
System" c4Type="Software System" c4Description="Stores all of the core banking
information." label="<font style="font-size: 16px"><b>%c4Name%</b></font><div>[%c4Type%]</div><br><div><font style="font-size: 11px"><font color="#cccccc">%c4Description%</font></div>" id="v1w6xJLIwrtz22bP0FQ9-17">
<mxCell style="rounded=1;whiteSpace=wrap;html=1;labelBackgroundColor=none;fillColor=#8C8496;fontColor=#ffffff;align=center;arcSize=10;strokeColor=#736782;metaEdit=1;resizable=0;points=[[0.25,0,0],[0.5,0,0],[0.75,0,0],[1,0.25,0],[1,0.5,0],[1,0.75,0],[0.75,1,0],[0.5,1,0],[0.25,1,0],[0,0.75,0],[0,0.5,0],[0,0.25,0]];" parent="1" vertex="1">
<mxGeometry x="40" y="520" width="240" height="120" as="geometry" />
</mxCell>
</object>
<object placeholders="1" c4Type="Relationship" c4Description="Uses" label="<div style="text-align: left"><div style="text-align: center"><b>%c4Description%</b></div>" id="v1w6xJLIwrtz22bP0FQ9-18">
<mxCell style="endArrow=blockThin;html=1;fontSize=10;fontColor=#404040;strokeWidth=1;endFill=1;strokeColor=#828282;elbow=vertical;metaEdit=1;endSize=14;startSize=14;jumpStyle=arc;jumpSize=16;rounded=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;exitPerimeter=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="v1w6xJLIwrtz22bP0FQ9-13" target="v1w6xJLIwrtz22bP0FQ9-17" edge="1">
<mxGeometry width="240" relative="1" as="geometry">
<mxPoint x="350" y="250" as="sourcePoint" />
<mxPoint x="278" y="290" as="targetPoint" />
</mxGeometry>
</mxCell>
</object>
<object placeholders="1" c4Type="Relationship" c4Technology="SMTP" c4Description="Sends e-mails" label="<div style="text-align: left"><div style="text-align: center"><b>%c4Description%</b></div><div style="text-align: center">[%c4Technology%]</div></div>" id="v1w6xJLIwrtz22bP0FQ9-19">
<mxCell style="endArrow=blockThin;html=1;fontSize=10;fontColor=#404040;strokeWidth=1;endFill=1;strokeColor=#828282;elbow=vertical;metaEdit=1;endSize=14;startSize=14;jumpStyle=arc;jumpSize=16;rounded=0;edgeStyle=orthogonalEdgeStyle;exitX=1;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="v1w6xJLIwrtz22bP0FQ9-13" target="v1w6xJLIwrtz22bP0FQ9-14" edge="1">
<mxGeometry width="240" relative="1" as="geometry">
<mxPoint x="290" y="450" as="sourcePoint" />
<mxPoint x="530" y="450" as="targetPoint" />
</mxGeometry>
</mxCell>
</object>
</root>
</mxGraphModel>
</diagram>
</mxfile>
|
Is it somehow configurable where the sidecar container runs (host & port)? |
This information is missing from the documentation but yes you can configure on which host/port the gateway/main server ( kroki/server/src/main/java/io/kroki/server/service/Diagramsnet.java Lines 36 to 37 in 6e3496d
https://docs.kroki.io/kroki/setup/configuration/#_companion_container_host_and_port |
Seems like the svg document size is always 300x150px, which leads to the diagram not being rendered fully when kroki is referenced in the |
I'd love to be able to integrate this into my internal Wiki.js with Kroki.
All the other types of diagrams work within my Wiki by calling up kroki.
Are there some complete step-by-step instructions ? |
@tfboy I don't know the Kroki integration works on your Wiki so I can't really help. I would recommend to call Kroki directly using an HTTP client to make sure that your configuration is fine:
|
Merci Guillaume !
Next question: what / how is that code (base64 hash?) generated ? Edit: The "code" my drawings seem to produce is the same format as the one you posted earlier with the viewer. I can use the viewer url adding the 1#R as a prefix and it works for viewing them online. However, the format for the "demo" pictures which work with Kroki is different. So I guess my question is what needs to be done to obtain this format? I can't find the "demo" source code online to see how it's translated or extracted. |
The encode process is described here: https://docs.kroki.io/kroki/setup/encode-diagram/ Feel free to join kroki.zulipchat.com if you have additional questions. The issue tracker is the preferred channel for reporting verifiable bugs, regressions, and security vulnerabilities or for making formal change requests. Whereas the project chat is the preferred means of communication. |
Hi! Thanks, this works nicely! Regarding PNG export, is there any way/plan to choose a specific output width/height? EDIT: I've started a discussion here https://kroki.zulipchat.com/#narrow/stream/232085-users/topic/Discussions.20.2F.20feature.20requests.20for.20diagrams.2Enet.20support |
Raised #1726 |
Input
Output
Please note that diagrams.net has an online viewer where the diagram hash (base64 deflate?) is used. The URL seems to be
https://viewer.diagrams.net/?highlight=0000ff&edit=_blank&layers=1&nav=1#R
+ diagram hash.For instance: https://viewer.diagrams.net/?highlight=0000ff&edit=_blank&layers=1&nav=1#RjZJNT8MwDIZ/TY6T2gb2caUMKgHiMAHTLihrTBMprassIx2/npS67appElIO8eOPxK/NeFo2j1bU6gUlGJZEsmH8niVJfJMkrD2RPHVkGS07UFgtKWgEG/0DBCOiRy3hMAl0iMbpegpzrCrI3YQJa9FPw77QTF+tRQEXYJMLc0k/tHSKukgWI89AF6p/OZ6vOk8p+mDq5KCERH+G+Jrx1CK67lY2KZhWvF6XLu/hinf4mIXK/Sfh/W32vKhXO8w+n+rtbpv5/euMqnwLc6SGs5CFAXm0Qaru5+7Uy2HxWEloK0aM33mlHWxqkbdeHxYgMOVKE6w4XKk2WAfN1U/HgxRhhwBLcPYUQiiB35J6tD58SbYfhxH3CquzQcyJCZp/MZQeJQoXUqk3x2n8+c52mq9/AQ==
Format:
hello.svg
hello.png
hello.jpeg
hello.pdf
hello.vsdx
(beta)Runtime
JavaScript
Project
https://github.com/jgraph/mxgraph2
The text was updated successfully, but these errors were encountered: