MkDocs plugin for displaying draw io file with url
Project description
MkDocs Plugin for embedding Drawio files with url
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)
![](../other-diagram.drawio)
Setup
Install plugin using pip:
pip install mkdocs-drawio-url
Add the plugin to your mkdocs.yml
plugins:
- drawio-url
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.
If you want to use a self-hosted JavaScript viewer file. You should download the latest version from the official drawio repo.
plugins:
- drawio-url:
viewer_js: "https://viewer.diagrams.net/js/viewer-static.min.js"
How it works
- mkdocs generates the html per page
mkdocs-drawio-url
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
File details
Details for the file mkdocs_drawio_url-1.0.1.tar.gz
.
File metadata
- Download URL: mkdocs_drawio_url-1.0.1.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.9.18 Linux/6.5.0-44-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ecd45f8e5eb02c594a3ec645cbafca214cbfa4d2b502a0cb15c970750d07bdc |
|
MD5 | b0d5f521ed794d0803b1ba5d37962fa8 |
|
BLAKE2b-256 | 0dc5fa15fb74d0995b4992948f01b172a155f54d73a74aac1b008a4b616276d0 |
File details
Details for the file mkdocs_drawio_url-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: mkdocs_drawio_url-1.0.1-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.9.18 Linux/6.5.0-44-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3241c5cc574bf7bfbe196768219a62bf3bf0a314671ab4cca33431ca99acdc78 |
|
MD5 | b60821abc87a5ea2784dfe89bf2055e7 |
|
BLAKE2b-256 | 0b5d321dc2980916734b6a9c258a31719e7011d6f32de95f26e1424884c8a558 |