Archeme preprocessor finds diagram definitions that are described with Archeme DSL, in source Markdown content, then calls Archeme and Graphviz to draw diagrams, and then replaces the diagram definitions with image references.
$ pip install foliantcontrib.archeme
To enable the preprocessor, add
preprocessors section in the project config:
preprocessors: - archeme
The preprocessor has a number of options with the following default values:
preprocessors: - archeme: cache_dir: !path .archemecache graphviz_paths: dot: dot neato: neato fdp: fdp config_concat: false config_file: null action: generate format: png targets: 
Some values of options specified in the project config may be overridden by tag attributes, see below.
: Directory to store generated Graphviz sources and drawn diagram images.
: Paths to binaries of Graphviz engines to be used in external commands:
: Flag that tells the preprocessor to read the config file and the diagram definition as YAML strings, concatenate these strings, and then load the concatenation result, i.e. single YAML string, as an object. If this option is not set (by default), config and diagram definition will be loaded as separate objects, and then merged. This option may be useful when some aliases are defined in the config, and you would like to use their values in the diagram definition.
: Path to default config file. May be overridden with the value of the respective
config_file tag attribute, see below. Config file usually defines common settings of multiple diagrams, it’s recommended but not strictly required. By default, no config file is used.
: Default action. Used when the respective
action tag attribute is not specified explicitly, see below. Available values are:
generate (default), and
merge (see descriptions in Archeme documentation).
: Format of the output image. May take any value supported by Graphviz, but note that drawn images are used within Markdown content that will be rendered by one or another backend. Preferred values are:
png (default), and
svg. The value of this option may be overridden by the respective
format tag attribute.
: Allowed targets for the preprocessor. If not specified (by default), the preprocessor applies to all targets. Limitation of available targets may be useful when it’s needed to build a certain Foliant project in different ways with various settings, e.g. as a stand-alone documentation (for example, with the
site target), and as a part of a documentation that combines several Foliant projects (in this case the
pre target is usually used).
To insert an Archeme diagram definition into your Markdown source, enclose it between
<archeme> structure: - node: id: first - node: id: second edges: - tail: first head: second </archeme>
You may use optional tag attributes:
caption—to set an alternative text description of the diagram that may be rendered as image caption by some backends;
module_id—to specify an unique ID of the diagram that may be used for merging multiple diagram definitions;
action—action that should be applied to the diagram definition; the available values are
merge; this attribute overrides the respective
config_file—path to a specific config file for the certain diagram definition; this attribute overrides the respective
format—output image format for the certain diagram definition; this attribute overrides the respective
Diagram definition with explicitly specified ID, config file, and output format:
<archeme module_id="one" caption="Module 1" config_file="!project_path another_config.yml" format="svg"> structure: - node: id: first - node: id: second edges: - tail: first head: second </archeme>
Archeme DSL definition that prescribes to combine two modules with explicitly specified IDs:
<archeme action="merge"> structure: - module: id: one - module: id: two </archeme>
Note that the
description module parameters in Archeme DSL work as usual. If you need to combine the diagrams that are identified within the current Foliant project by using
<archeme module_id="..."> tags, you should to omit the
description module parameters in your combined diagrams definitions.