MkDocs plugin for embedding Drawio files
Project description
MkDocs Plugin for embedding Drawio files
Sergey (onixpro) is the original creator of this plugin. Repo can be found here.
Features
This plugin enables you to embed interactive drawio diagrams in your documentation. Simply add your diagrams like you would any other image:
![](my-diagram.drawio)
Additionally this plugin supports multi page diagrams by using the alt
text to select the pages by name:
![Page-2](my-diagram.drawio)
![my-custom-page-name](my-diagram.drawio)
Setup
Install plugin using pip:
pip install mkdocs-drawio
Add the plugin to your mkdocs.yml
plugins:
- drawio
Configuration
By default the plugin uses the official url for the minified drawio javascript library. To use a custom source for the drawio viewer you can overwritte the url. This might be useful in airlocked environments.
plugins:
- drawio:
viewer_js: "https://viewer.diagrams.net/js/viewer-static.min.js"
How it works
- mkdocs generates the html per page
mkdocs-drawio
attaches to theon_post_page
event. For more details, please have a look at the event lifecycle documentation- Adds the drawio viewer library
- Searches through the generated html for all
img
tags that have a source of type.drawio
- Replaces the found
img
tags withmxgraph
html blocks (actual drawio diagram content). For more details, please have a look at the official drawio.com documentation.
Contribution guide
- Either use the devcontainer or setup a venv with mkdocs installed
- Install your current local version:
pip install -e .
- Add a test for your changes in the
example
directory - Test your changes by starting
mkdocs serve
in theexample
directory - Increase the version
pyproject.toml
andsetup.py
- Open pull request
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for mkdocs_drawio-1.6.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3195b01802213734d130364a1ae4a144133588676f6f6dbfe9f6b081f46e51e7 |
|
MD5 | 35f0964de6b6d0df58ce3e5f6eb6a004 |
|
BLAKE2b-256 | 72002e583855f5daf0ac07c52c99f0f0e48b56dd38d8f9284c12f071cf7fdfd3 |