Skip to main content

GraphViz diagrams preprocessor for Foliant.

Project description

Graphviz Diagrams Preprocessor for Foliant

Graphviz is an open source graph visualization tool. This preprocessor converts Graphviz diagram definitions in the source and converts them into images on the fly during project build.

Installation

$ pip install foliantcontrib.graphviz

Config

To enable the preprocessor, add graphviz to preprocessors section in the project config:

preprocessors:
    - graphviz

The preprocessor has a number of options:

preprocessors:
    - graphviz:
        cache_dir: !path .diagramscache
        graphviz_path: dot
        engine: dot
        format: png
        as_image: true
        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.

graphviz_path : Path to Graphviz launcher. By default, it is assumed that you have the dot command in your PATH, but if Graphviz uses another command to launch, or if the dot launcher is installed in a custom place, you can define it here.

engine : Layout engine used to process the diagram source. Available engines: (circo, dot, fdp, neato, osage, patchwork, sfdp twopi). Default: dot

format : Output format of the diagram image. Available formats: tons of them. Default: png

as_image : If true — inserts scheme into document as md-image. If false — inserts the file generated by GraphViz directly into the document (may be handy for svg images). Default: true

params : Params passed to the image generation command:

    preprocessors:
        - graphviz:
            params:
                Gdpi: 100

To see the full list of params, run the command that launches Graphviz, with -? command line option.

Usage

To insert a diagram definition in your Markdown source, enclose it between <graphviz>...</graphviz> tags:

Here’s a diagram:

<graphviz>
    a -> b
</graphviz>

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 two exclusive options: caption option — the markdown caption of the diagram image and src — path to diagram source (relative to current file).

If src tag option is supplied, tag body is ignored. Diagram source is loaded from external file.

Diagram with a caption:

<graphviz caption="Deployment diagram"
           params="Earrowsize: 0.5"
           src="diags/sample.gv">
</graphviz>

Note that command params listed in the params option 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'}.

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.graphviz-1.1.5.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

foliantcontrib.graphviz-1.1.5-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file foliantcontrib.graphviz-1.1.5.tar.gz.

File metadata

  • Download URL: foliantcontrib.graphviz-1.1.5.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for foliantcontrib.graphviz-1.1.5.tar.gz
Algorithm Hash digest
SHA256 715fca5407f9ac4985b328ccc6649e340e29e8c363c574c19411d22783e292f2
MD5 850826d35fd31c6e3fd68e9f918f2a1c
BLAKE2b-256 c0ce17779314850aea68ff3fa8f7af1b5d40ceee5a0edccfd77bf2ff59a20fe3

See more details on using hashes here.

File details

Details for the file foliantcontrib.graphviz-1.1.5-py3-none-any.whl.

File metadata

  • Download URL: foliantcontrib.graphviz-1.1.5-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for foliantcontrib.graphviz-1.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 a5b0af5f357100a715090a60de717934d7095c05741df509a2f3874ba5589ccc
MD5 4fab55fb47917d36452878ac5a364b25
BLAKE2b-256 87ee21108a8ead2636d022f07870859617f154a29c11b11abc84b122635bbb6f

See more details on using hashes here.

Supported by

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