Skip to content

Instantly share code, notes, and snippets.

@LiberiFatali
Forked from philip-gai/github-drawio-demo.md
Created September 18, 2023 11:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LiberiFatali/94a1516f5b200cc4ce4fd8dd624b3876 to your computer and use it in GitHub Desktop.
Save LiberiFatali/94a1516f5b200cc4ce4fd8dd624b3876 to your computer and use it in GitHub Desktop.
How to integrate diagrams.net (draw.io) with your GitHub repo

Embedding Diagrams in GitHub Markdown

This explains and demos how to use diagrams.net (draw.io) diagrams in your GitHub repo.

  • See repo for more details

Benefits of using diagrams.net in GitHub repositories

  1. Diagrams are stored in your repository with your code and docs
  2. Diagram access is controlled by GitHub repository access
  3. Diagrams are version-controlled using git
  4. Create PRs with diagram updates to get approvals and feedback
  5. One-click diagram editing from your GitHub repository
  6. diagrams.net is open-source: https://github.com/jgraph/drawio

How to integrate diagrams.net (draw.io) with your GitHub repo

Note: Images in markdown are cached and can take five minutes to update

Using VS Code locally, on github.dev or on CodeSpaces (Recommended)

This method does not require any OAuth or GitHub app approvals and defaults to offline mode. 🎉

Using the [Draw.io Visual Studio Code extension], you can do this in github.dev, Codespaces or locally on VS Code.

  1. Open the repository you want to create the diagram in
  2. Press . to open github.dev (or use Codespaces, or clone and use VS Code locally)
  3. Install the [Draw.io Visual Studio Code extension]
  4. Open or save a file ending with .drawio.svg or .drawio.png (svg is recommended). This will open the draw.io editor in VS Code.
  5. Reference the file using a relative link in markdown like you would reference any file ![Label](relative link)
  6. It will now live-update, you can use PRs to review changes, and you didn't need to authorize anything! 🚀

Reference: https://github.com/hediet/vscode-drawio#readme

Draw.io Extension Demo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment