MkDocs plugin for Kroki-Diagrams
Project description
mkdocs-kroki-plugin
This is a MkDocs plugin to embed Kroki-Diagrams into your documentation.
Setup
Install the plugin using pip:
pip install mkdocs-kroki-plugin
Activate the plugin in mkdocs.yml
:
plugins:
...
- kroki:
Config
Key | Description |
---|---|
ServerURL |
URL of your kroki-Server, default: !ENV [KROKI_SERVER_URL, 'https://kroki.io'] |
FencePrefix |
Diagram prefix, default: kroki- |
EnableBlockDiag |
Enable BlockDiag (and the related Diagrams), default: true |
EnableBpmn |
Enable BPMN, default: true |
EnableExcalidraw |
Enable Excalidraw, default: true |
EnableMermaid |
Enable Mermaid, default: true |
EnableDiagramsnet |
Enable diagrams.net (draw.io), default: false |
HttpMethod |
Http method to use (GET or POST ), default: GET Note: On POST the retrieved images are stored next to the including page in the build directory |
UserAgent |
User agent for requests to the kroki server, default: kroki.plugin/<version> |
FileTypes |
File types you want to use, default: [svg] Note: not all file formats work with all diagram types https://kroki.io/#support |
FileTypeOverrides |
Overrides for specific diagram types to set the desired file type, default: empty |
TagFormat |
How the image will be included in the resulting HTML, default: img ( img , object , svg ) |
FailFast |
Errors are raised as plugin errors, default: false |
Example:
- kroki:
ServerURL: !ENV [KROKI_SERVER_URL, 'https://kroki.io']
FileTypes:
- png
- svg
FileTypeOverrides:
mermaid: png
FailFast: !ENV CI
Usage
Use code-fences with a tag of kroki-<Module>
to replace the code with the wanted diagram.
Diagram options can be set as well.
Example for BlockDiag:
```kroki-blockdiag no-transparency=false
blockdiag {
blockdiag -> generates -> "block-diagrams";
blockdiag -> is -> "very easy!";
blockdiag [color = "greenyellow"];
"block-diagrams" [color = "pink"];
"very easy!" [color = "orange"];
}
```
You can render diagram from file with @from_file:
directive:
```kroki-bpmn
@from_file:path/to/diagram.bpmn
```
See Also
Diagram examples can be found here.
More information about installing a self-manged Kroki-Service here.
More Plugins for MkDocs can be found here
Pre-Release-Versions
Install the newest pre-release version using pip:
pip install -i https://test.pypi.org/simple/ mkdocs-kroki-plugin
Development
Setup:
git clone git@github.com:AVATEAM-IT-SYSTEMHAUS/mkdocs-kroki-plugin.git
cd mkdocs-kroki-plugin
pipx install hatch
pipx install pre-commit
pre-commit install
Run tests (for all supported python versions):
hatch test -a
Run static code analysis:
hatch fmt
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_kroki_plugin-0.9.0.tar.gz
.
File metadata
- Download URL: mkdocs_kroki_plugin-0.9.0.tar.gz
- Upload date:
- Size: 9.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.27.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a153d2eaed6f661dbc8577c98e5d7d85609cc50c3a15ca37aa7260fc277f2306 |
|
MD5 | 064e69406089648b9f15c7126660a1ee |
|
BLAKE2b-256 | 5c344a6c26c342bae4e864a99771fad867fa29f31a73887904b1bfb0301f598c |
File details
Details for the file mkdocs_kroki_plugin-0.9.0-py3-none-any.whl
.
File metadata
- Download URL: mkdocs_kroki_plugin-0.9.0-py3-none-any.whl
- Upload date:
- Size: 12.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.27.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | da9e48241913b1749d79f9facb8c58ca413c3413c0637ea9c3e001e986134b52 |
|
MD5 | 040d0e36299bf06f1a394da821fb01ab |
|
BLAKE2b-256 | 0e5144c14c9d022fb61706d8f03a391ab385dd6d20f9704efaa8af81ebc16c7d |