Comment

Comment by spellcard199

I 'm an heavy user of diagrams to take notes while learning topics in biology and medicine. I think the most interesting feature of diagrams.net is its extensibility, which is not frequently mentioned. If you run in the javascript console...

    var editorUi;
    Draw.loadPlugin(app => editorUi = app)
    var editor = editorUi.editor
    var graph = editor.graph
... then you can automate changes to the diagram using mxGraph's api [1] on the `graph' variable from the console.

Around this plugin mechanism I wrote some dirty hacks for personal use to make the editor behave more to my likings [2] (some features stopped working with recent versions of the desktop app), and an even dirtier Emacs mode for editing labels and having the js REPL available directly from Emacs when I need to run some code to fix my diagrams programmatically [3] (based on Indium [4] + the fact that electron apps can be launched with --remote-debugging-port=...). It's not pretty, but works enough for me, and it's only thanks to the customizability that diagrams.net allows.

[1] https://jgraph.github.io/mxgraph/docs/js-api/files/view/mxGr...

[2] https://gitlab.com/spellcard199/drawio-plugin-eight-droves-o...

[3] https://gitlab.com/spellcard199/emacs-drawio

[4] https://github.com/NicolasPetton/Indium

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton