Skip to main content

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'}.

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.4.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

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

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: foliantcontrib.graphviz-1.1.4.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for foliantcontrib.graphviz-1.1.4.tar.gz
Algorithm Hash digest
SHA256 71c2e4828d6a475978f2f1dddd533c2d8ec5337df8f2806672649b347d9c4549
MD5 108b075fcc8b81fcd1b79b0a25288e9f
BLAKE2b-256 f4f948b8b0d246fc9ab1d3a9db8c2ba44428b3d806252832bac9111ac9cfa848

See more details on using hashes here.

File details

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

File metadata

  • Download URL: foliantcontrib.graphviz-1.1.4-py3-none-any.whl
  • Upload date:
  • Size: 5.8 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/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for foliantcontrib.graphviz-1.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c554334477bea42d0b3231d8ff5c5bc2ed5b8b2b2c8e63d54c83d0c9e457c683
MD5 8df6fd42669a46ae16c3dba736c9efe4
BLAKE2b-256 f1c1741aaf95510d1da2f4dc61340c9aef87a33c7f168f7cfeb13304528dc1d6

See more details on using hashes here.

Release history Release notifications | RSS feed

1.1.7

2 files

1.1.5

2 files

This release

1.1.4 This release

2 files

1.1.3

2 files

1.1.2

2 files

1.1.1

2 files

1.1.0

2 files

1.0.6

2 files

1.0.5

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page