Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

foliantcontrib.plantuml-1.0.8.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

foliantcontrib.plantuml-1.0.8-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file foliantcontrib.plantuml-1.0.8.tar.gz.

File metadata

  • Download URL: foliantcontrib.plantuml-1.0.8.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.6

File hashes

Hashes for foliantcontrib.plantuml-1.0.8.tar.gz
Algorithm Hash digest
SHA256 1f99362397f91b8dd11382a5bfc7605b7ee4f33bb0a524186641e60e826f11d2
MD5 deccb9a914c689f5db7ca98ff4b28bf4
BLAKE2b-256 49b205bad009fd65b1d9979acbe0bf55127e7bd7f60fdef5ddeb32819713133f

See more details on using hashes here.

File details

Details for the file foliantcontrib.plantuml-1.0.8-py3-none-any.whl.

File metadata

  • Download URL: foliantcontrib.plantuml-1.0.8-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.6

File hashes

Hashes for foliantcontrib.plantuml-1.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 046e12042ce1f6955abbad369dff142cff39be61496301d49d46b25cbe77f6ed
MD5 e8f8cde7d471bc03f11ac5b8c07d07c4
BLAKE2b-256 f36b25eecca60b62004fa3c8042f4532797eb1b15fd4c68df2530f45c3311fca

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page