Skip to main content
# Graphviz Diagrams Preprocessor for Foliant

[Graphviz](http://plantuml.com/) 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

```bash
$ pip install foliantcontrib.graphviz
```

## Config

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

```yaml
preprocessors:
- graphviz
```

The preprocessor has a number of options:

```yaml
preprocessors:
- graphviz:
cache_dir: !path .diagramscache
graphviz_path: dot
engine: dot
format: png
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](https://graphviz.gitlab.io/_pages/doc/info/output.html). Default: `png`

`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:

```markdown
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 relative to foliant **src** directory to diagram source.

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

```markdown
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.0.1.tar.gz (5.8 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.0.1-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: foliantcontrib.graphviz-1.0.1.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.14.2 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.1

File hashes

Hashes for foliantcontrib.graphviz-1.0.1.tar.gz
Algorithm Hash digest
SHA256 75968d44c777d5f527c9394c8d007d32a46115f624dc2272cf72e20f5f9a48a8
MD5 74ba7ca0bf9a26db18e5128290e037dd
BLAKE2b-256 d5fe652c0a6279855090f11b68db153854a1671e6ad14db33a665eb96314d878

See more details on using hashes here.

File details

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

File metadata

  • Download URL: foliantcontrib.graphviz-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.14.2 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.1

File hashes

Hashes for foliantcontrib.graphviz-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dcf1b26f695c83d3076c69b9ddc4cbb1a82eaf045421f4ade9fba69cb399c59a
MD5 7af97545c114d9ceb9beef24bad98c8c
BLAKE2b-256 64e91a80afc32a7501914cb12849694ff7e1ef48a37bb8c2585d0985df24ac63

See more details on using hashes here.

Release history Release notifications | RSS feed

1.1.7

2 files

1.1.5

2 files

1.1.4

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

This release

1.0.1 This release

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