Skip to main content

Argdown diagrams preprocessor for Foliant.

Project description

Argdown Diagrams Preprocessor for Foliant

Argdown is modeling language for creating argument maps. This preprocessor converts Argdown diagram definitions in source markdown files and converts them into images on the fly during project build.

This preprocessor uses Argdown Image Export package tool by Christian Voigt to convert diagrams into images.

Installation

$ pip install foliantcontrib.argdown

You will also need to install Argdown CLI and the Image Export package:

$ npm install -g @argdown/cli
$ npm install -g @argdown/image-export

Config

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

preprocessors:
    - argdown

The preprocessor has a number of options:

preprocessors:
    - argdown:
        cache_dir: !path .diagramscache/argdown
        converter_path: argdown
        format: png
        as_image: true
        params:
            no-title: true
        `fix_svg_size`: false

cache_dir : Path to the cache directory for the generated diagrams. It can be a path relative to the project root or a global one.

To save time during build, only new and modified diagrams are rendered. The generated images are cached and reused in future builds.

converter_path : Path to Argdown CLI. By default, it is assumed that you have the argdown command in your PATH, but if it is not the case you can define it here. Default: argdown

format : Output format of the diagram image. Available formats at the time of writing: dot, graphml, svg, pdf, png, jpg, webp. Default: png

as_image : If true — inserts the diagram into the document as Markdown-image. If false — inserts the svg code of the diagram directly into the document (works only for svg format). Default: true

params : Params passed to the Argdown CLI map tool. Value of this option must be a YAML-mapping. Params which require values should be specified as param: value; params which don't require values should be specified as param: true.

To see the full list of available params, run argdown map --help.

fix_svg_size : Works only with svg format and as_image: false. By default svg is embedded with hardcoded width and height so they may exceed the boundaries of your HTML page. If this option is set to true the svg width and height will be set to 100% which will make it fit inside your content container. Default: false.

Usage

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

Here’s the diagram:

<argdown>
===
title: The Core Argument of Populism
author: David Lanius
date: 27/10/2018
===


This is a recontruction of right-wing populist argumentation 
based on the electoral platform of the German party...
</argdown>

You can override preprocessor parameters in the tag options. For example if the format for diagrams is set to png in foliant.yml and you need one of your diagrams to render in svg, override the format option in the tag:

SVG diagram:

<argdown format="svg">
...
</argdown>

Tags also have an exclusive option caption — the markdown caption of the diagram image.

Diagram with a caption:

<argdown caption="Diagram of the opposing arguments">
...
</argdown>

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.argdown-0.1.0.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

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

foliantcontrib.argdown-0.1.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file foliantcontrib.argdown-0.1.0.tar.gz.

File metadata

  • Download URL: foliantcontrib.argdown-0.1.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.10

File hashes

Hashes for foliantcontrib.argdown-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8027326b23a2c4c982b5dbb246f474bde1bd2410645f6dd23828eb80a028c775
MD5 fa67df00bcec469066b3da744652e308
BLAKE2b-256 4f669765e018c5ccd5c46c92925ed935da43efec4f6f8d1daef0ed91123d4c39

See more details on using hashes here.

File details

Details for the file foliantcontrib.argdown-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: foliantcontrib.argdown-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.10

File hashes

Hashes for foliantcontrib.argdown-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 638c8c04aedcaf57dba98c1b42f8f286b9ef5239bb3cbcb62c1dd8007c28e82c
MD5 b4263258dba6fb08e009eb1ecc0fc6b0
BLAKE2b-256 ae37d6a1fef29bcc18d0b27e302230d91a4739100de5e391c8caae787697065d

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