question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add support for diagrams.net (draw.io)

See original GitHub issue

Input

<mxfile host="app.diagrams.net" modified="2020-10-03T15:11:57.367Z"
        agent="5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36"
        etag="11WjPOqNS_m0kgKlksbF" version="13.7.7" type="device">
  <diagram id="khsTyrV5h37nCq-FAsyN" name="Page-1">
    jZJNT8MwDIZ/TY6T2gb2caUMKgHiMAHTLihrTBMprassIx2/npS67appElIO8eOPxK/NeFo2j1bU6gUlGJZEsmH8niVJfJMkrD2RPHVkGS07UFgtKWgEG/0DBCOiRy3hMAl0iMbpegpzrCrI3YQJa9FPw77QTF+tRQEXYJMLc0k/tHSKukgWI89AF6p/OZ6vOk8p+mDq5KCERH+G+Jrx1CK67lY2KZhWvF6XLu/hinf4mIXK/Sfh/W32vKhXO8w+n+rtbpv5/euMqnwLc6SGs5CFAXm0Qaru5+7Uy2HxWEloK0aM33mlHWxqkbdeHxYgMOVKE6w4XKk2WAfN1U/HgxRhhwBLcPYUQiiB35J6tD58SbYfhxH3CquzQcyJCZp/MZQeJQoXUqk3x2n8+c52mq9/AQ==
  </diagram>
</mxfile>

Output

hello

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

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:19
  • Comments:19 (9 by maintainers)

github_iconTop GitHub Comments

7reactions
Mogzttercommented, Apr 25, 2021

I took a look at https://github.com/jgraph/drawio and here’s my report:

  • diagrams.net uses client-side (browser) export
  • with a few changes to export.js it’s possible to use Puppeteer to load export3.html and convert a diagram
    • Chrome 90+ does not load the diagram properly using file:// protocol (even when if I forcibly disable web security) but it does work when using http://. It’s interesting to note that Firefox 87 does load the diagram properly using file:// or http://.
  • diagrams.net provides a CLI as part of the Electron Desktop application
    • It take approximately ~1 second to convert Wireframe.xml to SVG
    • It’s not possible to pass the input as stdin
    • It’s not possible to output the result as stdout

Since diagrams.net CLI is relatively fast (and will require less maintenance), I think we should either install it as part of yuzutech/kroki or build a small HTTP server on top of the CLI and package it in a new Docker image yuzutech/diagramsnet.

For reference, @rlespinasse did some work to provide diagrams.net CLI as a Docker image: https://github.com/rlespinasse/docker-drawio-desktop-headless We can take some inspiration from this, most notably to disable auto-update functionality and clear output log from Electron.

6reactions
Mogzttercommented, Mar 20, 2022

Experimental support will land on the next release.

diagrams.net will be available as a companion container (yuzutech/kroki-diagramsnet) but will not be available on https://kroki.io right away. Once we have enough feedback, I will see if I can enable it on the public instance. Since we are very close to the memory limit, we will probably need to add more memory to run this additional container. Currently, Exoscale and all the sponsors do not cover all the expenses of the public instance, the remaining balance is around 40€/month. Upgrading from medium instances (4Gb - 2 cores) to large (8gb - 4 cores) will increase the cost by 60€/month. So unless I can find additional sponsors or convince Exoscale to give me more processing power it won’t happen 😞

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configure the diagrams.net and draw.io editor
You can create a link to configure the online version of diagrams.net by clicking on Link in the Configuration dialog: Click on Help...
Read more >
Use the diagrams.net editor - draw.io is becoming diagrams.net
Click on ⋮ (vertical ellipses) underneath the drawing canvas to access the diagram page menu. · Click on the page tabs to view...
Read more >
Diagrams.net (Draw.io) Tutorial - Getting Started - YouTube
Let's take a look at how to get started creating flowcharts and infographics in this Diagrams. net ( Draw. io ) tutorial. Diagrams....
Read more >
Diagrams.net (Draw.io) embed - Slite Help Center
Add the Draw.io power up, if you don't have it. · In the Trello card, click on 'edit' on the Draw.io file. ·...
Read more >
draw.io Diagrams for Jira - Atlassian Marketplace
Fortune 500 proven. draw.io is built on the market leading diagramming technology, diagrams.net. Enterprise users expect the highest level of stability, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found