Add support for editing diagrams.net diagrams #529
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Continuing to look for better ways to work with diagrams and Docsy, I looked more closely at diagrams.net (formerly draw.io and often still referred to by that name).
diagrams.net has a few really great things going for it:
The last point is a key one for me - Often people will create documentation, add a diagram they created in some other tool and neglect to link back to the source file so it can be edited by future contributors (or future contributors don't have a license to the tool, or permission to open the source document!). With editable svg files combined with the service being free, that doesn't happen here.
This PR then allows you to add an exported
svg
of your diagram to the repo and include it in your markdown as you would any other image. Some javascript then scans the page for any svgs that have been displayed, determines if they're editable and if so displays an "edit" button when hovering over the image. Clicking it loads the diagram up in the online editor - It doesn't need any access to your repo at all as all the data is encoded into the URL.The tool also offers an embed mode but i found that less appealing as it requires you grant it access to your repo to access the underlying file.
Still something of a WIP at the moment, but thought I'd open the PR early for review/opinions.