PlantUML diagrams preprocessor for Foliant.
Project description
PlantUML Diagrams Preprocessor for Foliant
PlantUML is a tool to generate diagrams from plain text. This preprocessor finds PlantUML diagrams definitions in the source and converts them into images on the fly during project build.
Installation
$ pip install foliantcontrib.plantuml
Config
To enable the preprocessor, add plantuml
to preprocessors
section in the project config:
preprocessors:
- plantuml
The preprocessor has a number of options:
preprocessors:
- plantuml:
cache_dir: !path .diagramscache
plantuml_path: plantuml
params:
...
parse_raw: true
as_image: true
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.
plantuml_path
: Path to PlantUML launcher. By default, it is assumed that you have the command plantuml
in your PATH
, but if PlantUML uses another command to launch, or if the plantuml
launcher is installed in a custom place, you can define it here.
params
: Params passed to the image generation command:
preprocessors:
- plantuml:
params:
config: !path plantuml.cfg
To see the full list of params, run the command that launches PlantUML, with `-h` command line option.
parse_raw
: If this flag is true
, the preprocessor will also process all PlantUML diagrams which are not wrapped in <plantuml>...</plantuml>
tags. Default value is false
.
as_image
: If true
— inserts scheme into document as md-image. If false
— inserts the file generated by GraphViz directly into the document (only for svg
format). Default: true
Usage
To insert a diagram definition in your Markdown source, enclose it between <plantuml>...</plantuml>
tags (indentation inside tags is optional):
Here’s a diagram:
<plantuml>
@startuml
...
@enduml
</plantuml>
To set a caption, use caption
option:
Diagram with a caption:
<plantuml caption="Sample diagram from the official site">
@startuml
...
@enduml
</plantuml>
You can override values from the preprocessor config for each diagram.
By default, diagrams are in PNG. But this diagram is in EPS:
<plantuml caption="Vector diagram" format="eps">
@startuml
...
@enduml
</plantuml>
Sometimes it can be necessary to process auto-generated documents that contain multiple PlantUML diagrams definitions without using Foliant-specific tags syntax. Use the parse_raw
option in these cases.
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 foliantcontrib.plantuml-1.0.7.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e38a514f3c589324473ccaa91b63610e7f05451d8703a438a8b9eed41a707afb |
|
MD5 | 3af6ff6e2397b29b29e36f5fffc3ba79 |
|
BLAKE2b-256 | 8362baa686b54940eb38b581b2ac331e5ddc1da6494723f07e98176636ba87b9 |
Hashes for foliantcontrib.plantuml-1.0.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 103fbb8e1b33d64754c03087e19285d2901635b2b40707c01a5a165d5e895785 |
|
MD5 | 059fb3664daefbe735019188599cb839 |
|
BLAKE2b-256 | cdfd29f5508324cbc7e1c7b3d9593830254ce25d45ef7fe0d0f6f52dad0cfa5a |