Blockdiag Preprocessor for Foliant
Blockdiag is a tool to generate diagrams from plain text. This preprocessor finds diagram definitions in the source and converts them into images on the fly during project build. It supports all Blockdiag flavors: blockdiag, seqdiag, actdiag, and nwdiag.
Installation
$ pip install foliantcontrib.blockdiag
Config
To enable the preprocessor, add blockdiag to preprocessors section in the project config:
preprocessors:
- blockdiag
The preprocessor has a number of options:
preprocessors:
- blockdiag:
cache_dir: !path .diagramscache
blockdiag_path: blockdiag
seqdiag_path: seqdiag
actdiag_path: actdiag
nwdiag_path: nwdiag
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.
> **Note**
>
> To save time during build, only new and modified diagrams are rendered. The generated images are cached and reused in future builds.
*_path
: Paths to the blockdiag, seqdiag, actdiag, and nwdiag binaries. By default, it is assumed that you have these commands in PATH, but if they're installed in a custom place, you can define it here.
params
: Params passed to the image generation commands (blockdiag, seqdiag, etc.). Params should be defined by their long names, with dashes replaced with underscores (e.g. --no-transparency becomes no_transparency); also, -T param is called format for readability:
preprocessors:
- blockdiag:
params:
antialias: true
font: !path Anonymous_pro.ttf
To see the full list of params, run `blockdiag -h`.
Usage
To insert a diagram definition in your Markdown source, enclose it between <blockdiag>...</blockdiag>, <seqdiag>...</seqdiag>, <actdiag>...</actdiag>, or <nwdiag>...</nwdiag> tags (indentation inside tags is optional):
Here's a block diagram:
<blockdiag>
blockdiag {
A -> B -> C -> D;
A -> E -> F -> G;
}
</blockdiag>
Here's a sequence diagram:
<seqdiag>
seqdiag {
browser -> webserver [label = "GET /index.html"];
browser <-- webserver;
browser -> webserver [label = "POST /blog/comment"];
webserver -> database [label = "INSERT comment"];
webserver <-- database;
browser <-- webserver;
}
</seqdiag>
To set a caption, use caption option:
Diagram with a caption:
<blockdiag caption="Sample diagram from the official site">
blockdiag {
A -> B -> C -> D;
A -> E -> F -> G;
}
</blockdiag>
You can override params values from the preprocessor config for each diagram:
By default, diagrams are in png. But this diagram is in svg:
<blockdiag caption="High-quality diagram" format="svg">
blockdiag {
A -> B -> C -> D;
A -> E -> F -> G;
}
</blockdiag>
Metadata
Release files for foliantcontrib.blockdiag 1.0.8
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_blockdiag-1.0.8.tar.gz | 5.4 kB | Without provenance | Details for foliantcontrib_blockdiag-1.0.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| foliantcontrib_blockdiag-1.0.8-py3-none-any.whl | Python 3 | none | any | Details for foliantcontrib_blockdiag-1.0.8-py3-none-any.whl |
Total release size: 11.1 kB
Release files / foliantcontrib_blockdiag-1.0.8.tar.gz
| Download URL | foliantcontrib_blockdiag-1.0.8.tar.gz |
|---|---|
| Size | 5.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ee8d203d407624a131ef6fbf6d815740bad3584a7f44ef4aa686e8ccce5833eb
|
|
BLAKE2b-256 checksum How to use checksums |
17084dc2b8655476d1ebf5523817badb78ce5cd2edf1b2b3aaf00d2aa7f12c2d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.21
|
Release files / foliantcontrib_blockdiag-1.0.8-py3-none-any.whl
| Download URL | foliantcontrib_blockdiag-1.0.8-py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
099c24ef9f084fb6f1f6db4b49de2cfb6182f40a6e1cdddefd2fc2544054bc1a
|
|
BLAKE2b-256 checksum How to use checksums |
cd2259183cbebfb9246c6b153a84127c916b16868a91d861c586ca197f7472df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.21
|
Security for foliantcontrib.blockdiag 1.0.8
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.