MkDocs-Build-Plantuml-Plugin
Table of Contents
- About the Project
- Prerequisites
- Installation
- Usage
- Dark Mode Support
- Known restrictions
- Changelog
- Contributing
About the Project
This plugin automates the generation of PlantUML image files when using mkdocs serve.
The motivation behind this plugin is to provide a solution for users who prefer not to use inline diagrams and have encountered challenges with non-functional !includes.
Note: If you want inline diagrams in your Markdown files
```plantuml
Alice -> Bob
```
this plugin does not meet your requirements. Please check out plantuml-markdown which does exactly that.
Prerequisites
You need to have installed:
- Python3 (>= 3.10)
- MkDocs
- Java for Plantuml (If running locally)
- Plantuml (if running locally)
- This plugin (needs httplib2 for server rendering)
On macOS you can install plantuml with homebrew which puts a plantuml executable in /opt/homebrew/bin/plantuml (Apple Silicon) or /usr/local/bin/plantuml (Intel).
Installation
pip3 install mkdocs-build-plantuml-plugin
Usage
Plugin Settings
In mkdocs.yml add this plugin section (depicted are the default values):
plugins:
- search
- build_plantuml:
render: 'server' # or "local" for local rendering
bin_path: 'plantuml' # ignored when render: server, defaults to PATH lookup
server: 'http://www.plantuml.com/plantuml' # official plantuml server
disable_ssl_certificate_validation: true # for self-signed and invalid certs
output_format: 'svg' # or "png"
allow_multiple_roots: false # in case your codebase contains more locations for diagrams (all ending in diagram_root)
diagram_root: 'docs/diagrams' # should reside under docs_dir
output_folder: 'out'
input_folder: 'src'
input_extensions: '' # comma separated list of extensions to parse, by default every file is parsed
exclude_dirs: ['.git'] # directories to exclude when walking the diagram root
It is recommended to use the server option, which is much faster than local.
Example folder structure
This would result in this directory layout:
docs/ # the default MkDocs docs_dir directory
diagrams/
include/ # for include files like theme.puml etc (optional, won't be generated)
out/ # the generated images, which can be included in your md files
subdir1/file1.svg # you can organise your diagrams in subfolders, see below
file.svg
src/ # the Plantuml sources
subdir1/file1.puml
subdir2/
file.puml
mkdocs.yml # mkdocs configuration file
When starting with mkdocs serve, it will create all diagrams initially.
Afterwards, it checks if the *.puml (or other ending) file has a newer timestamp than the corresponding file in out. If so, it will generate a new image (works also with includes). This way, it won‘t take long until the site reloads and does not get into a loop.
Including generated images
Inside your index.md or any other Markdown file you can then reference any created image as usual:
# My MkDocs Document
## Example Plantuml Images


Dark Mode Support
Since Version 1.4 this plugin can support dark mode when rendering with server.
Note: Dark mode / theme support is only available in server rendering mode, not local.
Setup for MkDocs Material 9.x
-
Configure the Material theme with a palette toggle in
mkdocs.yml:theme: name: material palette: - scheme: default toggle: icon: material/brightness-7 name: Switch to dark mode - scheme: slate toggle: icon: material/brightness-4 name: Switch to light mode
-
Enable theme support in this plugin:
plugins: - build_plantuml: render: "server" theme_enabled: true theme_folder: "include/themes" theme_light: "light.puml" theme_dark: "dark.puml"
-
Create two PlantUML theme files (e.g.,
light.pumlanddark.puml) with appropriate colors andskinparam backgroundColor transparentfor proper dark mode display. -
In the
outdirectory, both<file>.<ext>and<file>_dark.<ext>will be generated. -
Reference images in markdown with the
#darkablesuffix:
-
Add JavaScript to swap images on theme toggle (example):
extra_javascript: - javascript/images_dark.js
The JS uses a MutationObserver to watch for changes to
data-md-color-schemeattribute and swaps_darkimage variants accordingly. -
Optionally add CSS for dark mode styling using
[data-md-color-scheme="slate"]selector (example).
See the example folder for a complete working setup.
Example Output
Debugging
To see detailed plugin output (e.g. which diagrams are being processed and from where), run mkdocs with the --verbose flag:
mkdocs serve --verbose
mkdocs build --verbose
Known restrictions
- If you use
!includeand therender: "server"option, this plugin merges those files manually. If there are any issues or side effects because of that, please open a ticket. - Dark mode / theme support is currently only available in server rendering mode.
Changelog
See CHANGELOG.md for version history and breaking changes.
Contributing
Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.
Running Tests
pip install -e ".[test]"
pytest tests/ -v # All tests
pytest tests/ --ignore=tests/test_integration.py # Unit tests only
pytest tests/test_integration.py -v # Integration tests (requires network)
Metadata
Release files for mkdocs-build-plantuml-plugin 2.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| mkdocs_build_plantuml_plugin-2.1.0.tar.gz | 21.4 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mkdocs_build_plantuml_plugin-2.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 31.5 kB
Release files / mkdocs_build_plantuml_plugin-2.1.0.tar.gz
| Download URL | mkdocs_build_plantuml_plugin-2.1.0.tar.gz |
|---|---|
| Size | 21.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8843652ba58e431f5414e011ab6ac12d5549891171e7958d93ac3e3e834d6751
|
|
BLAKE2b-256 checksum How to use checksums |
c382b2b32ff84488d0b9b31ea266c21fc6c04518a2afe7fb3c146e04d7fccc0c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 24, 2026.
Transparency logRelease files / mkdocs_build_plantuml_plugin-2.1.0-py3-none-any.whl
| Download URL | mkdocs_build_plantuml_plugin-2.1.0-py3-none-any.whl |
|---|---|
| Size | 10.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
00496f6c23e928d5ae2c5e41a7d2bf3b929ebaf47feaa322f7206c142038ab43
|
|
BLAKE2b-256 checksum How to use checksums |
625baa16b8875d2983e107bf19fba6c111baf9d9644ff582ea5b0f7a10befe5b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 24, 2026.
Transparency logSecurity for mkdocs-build-plantuml-plugin 2.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for mkdocs_build_plantuml_plugin-2.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 24, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.