Mermaid Diagrams Preprocessor for Foliant
Mermaid is an open source diagram visualization tool. This preprocessor converts Mermaid diagram definitions in your Markdown files into images on the fly during project build.
Installation
$ pip install foliantcontrib.mermaid
Please note that to use this preprocessor you will also need to install Mermaid and Mermaid CLI:
$ npm install mermaid # installs locally
$ npm install mermaid.cli
Config
To enable the preprocessor, add mermaid to preprocessors section in the project config:
preprocessors:
- mermaid
The preprocessor has a number of options:
preprocessors:
- mermaid:
cache_dir: !path .diagramscache
mermaid_path: !path node_modules/.bin/mmdc
format: svg
params:
...
cache_dir
: Path to the directory with the generated diagrams. It can be a path relative to the project root or a global one; you can use ~/ shortcut.
To save time during build, only new and modified diagrams are rendered. The generated images are cached and reused in future builds.
mermaid_path
: Path to Mermaid CLI binary. If you installed Mermaid locally this parameter is required. Default: mmdc.
format
: Generated image format. Available: svg, png, pdf. Default svg.
params
: Params passed to the image generation command:
preprocessors:
- mermaid:
params:
theme: forest
To see the full list of available params, run
mmdc -hor check here.
Usage
To insert a diagram definition in your Markdown source, enclose it between <mermaid>...</mermaid> tags:
Here’s a diagram:
<mermaid>
graph TD;
A-->B;
</mermaid>
You can set any parameters in the tag options. Tag options have priority over the config options so you can override some values for specific diagrams while having the default ones set up in the config.
Tags also have an exclusive option caption — the markdown caption of the diagram image.
Diagram with a caption:
<mermaid caption="Deployment diagram"
params="theme: dark">
</mermaid>
Note that command params listed in the
paramsoption are stated in YAML format. Remember that YAML is sensitive to indentation so for several params it is more suitable to use JSON-like mappings:{key1: 1, key2: 'value2'}.
Metadata
Release files for foliantcontrib.mermaid 1.0.2
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 | Actions |
|---|---|---|---|---|
| foliantcontrib.mermaid-1.0.2.tar.gz | 5.5 kB | Without provenance | Details for foliantcontrib.mermaid-1.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| foliantcontrib.mermaid-1.0.2-py3-none-any.whl | Python 3 | none | any | Details for foliantcontrib.mermaid-1.0.2-py3-none-any.whl |
Total release size: 11.0 kB
Release files / foliantcontrib.mermaid-1.0.2.tar.gz
| Download URL | foliantcontrib.mermaid-1.0.2.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f8bb758923e6819eb1dd860c72a9f7cb298996a0d460a4ff4238ec7f4633a8eb
|
|
BLAKE2b-256 checksum How to use checksums |
bb7164cc35523d5b16528f4759b6a9f38a831cd25d5e01b6a6319e72edc1b5a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5
|
Release files / foliantcontrib.mermaid-1.0.2-py3-none-any.whl
| Download URL | foliantcontrib.mermaid-1.0.2-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f682cadced11ff3f9e062f8956b48f016a37e628318bfd69187c0678c669477d
|
|
BLAKE2b-256 checksum How to use checksums |
9088a8b561dc5fe00f54ebe43a4a0168afb6715471b263149074717a861f8b34
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5
|
Security for foliantcontrib.mermaid 1.0.2
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.