# MkDocs Plugin for embedding Drawio files with url
[Buy Sergey a ☕](https://www.buymeacoffee.com/SergeyLukin)
Sergey ([onixpro](https://github.com/onixpro)) is the original creator of this plugin. Repo can be found [here.](https://github.com/onixpro/mkdocs-drawio-file)
## Features
This plugin enables you to embed interactive drawio diagrams in your documentation. Simply add your diagrams like you would any other image:
```markdown
![](my-diagram.drawio)
![](../other-diagram.drawio)
```
## Setup
Install plugin using pip:
```
pip install mkdocs-drawio-url
```
Add the plugin to your `mkdocs.yml`
```yaml
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](https://github.com/jgraph/drawio/blob/dev/src/main/webapp/js/viewer-static.min.js).
```yaml
plugins:
- drawio-url:
viewer_js: "https://viewer.diagrams.net/js/viewer-static.min.js"
```
## How it works
1. mkdocs generates the html per page
2. `mkdocs-drawio-url` attaches to the `on_post_page` event. For more details, please have a look at the [event lifecycle documentation](https://www.mkdocs.org/dev-guide/plugins/#events)
3. Adds the drawio viewer library
4. Searches through the generated html for all `img` tags that have a source of type `.drawio`
5. Replaces the found `img` tags with `mxgraph` html blocks (actual drawio diagram content). For more details, please have a look at the [official drawio.com documentation](https://www.drawio.com/doc/faq/embed-html).
## Contribution guide
1. Either use the devcontainer or setup a venv with mkdocs installed
2. Install your current local version: `pip install -e .`
3. Add a test for your changes in the `example` directory
4. Test your changes by starting `mkdocs serve` in the `example` directory
5. Increase the version `pyproject.toml` and `setup.py`
6. Open pull request
Raw data
{
"_id": null,
"home_page": "https://github.com/sylvain121/mkdocs-drawio-url/",
"name": "mkdocs-drawio-url",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": "mkdocs, plugin, markdown, drawio",
"author": "Sergey Lukin",
"author_email": "onixpro@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/bd/95/c4b23ed9ca2219994e282008c02109424d86f489cce49cefd2779cc07dc7/mkdocs_drawio_url-1.0.0.tar.gz",
"platform": null,
"description": "# MkDocs Plugin for embedding Drawio files with url\n\n[Buy Sergey a \u2615](https://www.buymeacoffee.com/SergeyLukin) \n\nSergey ([onixpro](https://github.com/onixpro)) is the original creator of this plugin. Repo can be found [here.](https://github.com/onixpro/mkdocs-drawio-file)\n\n## Features\nThis plugin enables you to embed interactive drawio diagrams in your documentation. Simply add your diagrams like you would any other image:\n\n```markdown\n![](my-diagram.drawio)\n![](../other-diagram.drawio)\n```\n\n## Setup\n\nInstall plugin using pip:\n\n```\npip install mkdocs-drawio-url\n```\n\nAdd the plugin to your `mkdocs.yml`\n\n```yaml\nplugins:\n - drawio-url\n```\n\n### Configuration\n\nBy 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.\n\n> If you want to use a self-hosted JavaScript viewer file. You should download the latest version from the [official drawio repo](https://github.com/jgraph/drawio/blob/dev/src/main/webapp/js/viewer-static.min.js).\n\n```yaml\nplugins:\n - drawio-url:\n viewer_js: \"https://viewer.diagrams.net/js/viewer-static.min.js\"\n```\n\n## How it works\n\n1. mkdocs generates the html per page\n2. `mkdocs-drawio-url` attaches to the `on_post_page` event. For more details, please have a look at the [event lifecycle documentation](https://www.mkdocs.org/dev-guide/plugins/#events)\n3. Adds the drawio viewer library\n4. Searches through the generated html for all `img` tags that have a source of type `.drawio`\n5. Replaces the found `img` tags with `mxgraph` html blocks (actual drawio diagram content). For more details, please have a look at the [official drawio.com documentation](https://www.drawio.com/doc/faq/embed-html).\n\n\n## Contribution guide\n\n1. Either use the devcontainer or setup a venv with mkdocs installed\n2. Install your current local version: `pip install -e .`\n3. Add a test for your changes in the `example` directory\n4. Test your changes by starting `mkdocs serve` in the `example` directory\n5. Increase the version `pyproject.toml` and `setup.py`\n6. Open pull request\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "MkDocs plugin for displaying draw io file with url",
"version": "1.0.0",
"project_urls": {
"Homepage": "https://github.com/sylvain121/mkdocs-drawio-url/",
"Repository": "https://github.com/sylvain121/mkdocs-drawio-url/"
},
"split_keywords": [
"mkdocs",
" plugin",
" markdown",
" drawio"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "409119e1073397fe6643547029198439d3f3522126eed3d4ce3c28db1aad990d",
"md5": "6b929baa89eb58eb1ec1cc672192a469",
"sha256": "1f8e72a594c4080c6d686ac30e41e80ebd4f1e6c60d327e24887c84a5b514818"
},
"downloads": -1,
"filename": "mkdocs_drawio_url-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6b929baa89eb58eb1ec1cc672192a469",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 4470,
"upload_time": "2024-07-25T07:25:38",
"upload_time_iso_8601": "2024-07-25T07:25:38.900213Z",
"url": "https://files.pythonhosted.org/packages/40/91/19e1073397fe6643547029198439d3f3522126eed3d4ce3c28db1aad990d/mkdocs_drawio_url-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "bd95c4b23ed9ca2219994e282008c02109424d86f489cce49cefd2779cc07dc7",
"md5": "0997bf4b4fa27e8cee0cc2fb1a5dbaf2",
"sha256": "354cd0d8d9dd291f72fe174c8d42415fd1fed5e7dcdb7ac37d52846458adfca3"
},
"downloads": -1,
"filename": "mkdocs_drawio_url-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "0997bf4b4fa27e8cee0cc2fb1a5dbaf2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 3723,
"upload_time": "2024-07-25T07:25:40",
"upload_time_iso_8601": "2024-07-25T07:25:40.451227Z",
"url": "https://files.pythonhosted.org/packages/bd/95/c4b23ed9ca2219994e282008c02109424d86f489cce49cefd2779cc07dc7/mkdocs_drawio_url-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-25 07:25:40",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "sylvain121",
"github_project": "mkdocs-drawio-url",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "mkdocs-drawio-url"
}