MkDocs plugin to convert Mermaid code blocks to images.
Project description
MkDocs IZSAM Mermaid to images
This plugin processes each page's Markdown content, finds Mermaid code blocks, converts them to images using mermaid.cli
, and replaces the code blocks with image references. The image format can be specified in the mkdocs.yml
configuration file.
Installation
Install dependencies:
npm install -g @mermaid-js/mermaid-cli
Install the package with pip:
pip install mkdocs-izsam-mermaid-to-images
Enable the plugin in the mkdocs.yml
file:
plugins:
- search
- mkdocs-izsam-mermaid-to-images:
output_dir: mermaid_images # Optional, defaults to 'mermaid_images'
image_format: svg # Optional, defaults to 'svg'
image_class: mmd # Optional, defaults to 'mmd'
mermaid_config:
theme: default
fontFamily: "Arial, sans-serif"
fontSize: 16
See how to use MkDocs Plugins
Change log
[1.0.6] - 2024-09-17
Added support to Mermaid configuration options
[1.0.5] - 2024-09-17
Added class for generate img tag
Added a class to the generated tag and made it configurable by the user, default is 'mmd'.
[1.0.4] - 2024-09-17
Changed the way images directory are generated
Images directory now is generated in the same directory as the HTML file where the Mermaid diagrams are declared. This way, the image paths will be relative to the page, avoiding problems with paths.
[1.0.3] - 2024-09-17
Fix on image paths
The plugin was generating the image paths relative to the current page, but it should generate them relative to the root of the site.
[1.0.2] - 2024-09-17
Fix on image paths
Generated image files are not being found at the expected paths.
[1.0.1] - 2024-09-17
Setup bug fix and README changes
Bug fix for setup entry_points section; fix for error in configuration instructions.
[1.0] - 2024-09-17
First release
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_izsam_mermaid_to_images-1.0.6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 411420e5db987356dc6beb2c8b3080b11c8a630c660b5a25be3fea7f43e931e5 |
|
MD5 | 60e347a0bf261103060933a879b744a1 |
|
BLAKE2b-256 | 15464466b2ccd13027c9835e8e48da74fb2ed4adac3e7ee427a6af5480c04810 |
Hashes for mkdocs_izsam_mermaid_to_images-1.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 39e8900a21618970d0a104acf13d677ed907a61c210867abac0e727bbac5c08d |
|
MD5 | 807168b29c6df4107d12db5f929a4ce4 |
|
BLAKE2b-256 | f56d12ce89b1d116ac0306a26040f3d0fba5f221586f03651b67b099e6813276 |