Skip to main content

A jinja2 block to render a mermaid diagram

Project description

jinja2-mermaid-extension

Release Build status codecov Commit activity License

A jinja2 block to render a mermaid diagram.

Setup

  • Docker must be installed to run the mermaid command line tool.
  • The extension should be installed in your Python environment.
pip install jinja2-mermaid-extension
  • The extension should be added to the jinja2 environment.
from jinja2 import Environment
from jinja2_mermaid_extension import MermaidExtension

env = Environment(extensions=[MermaidExtension])

Usage

The following jinaj2 block will be transformed into an image and referenced in the rendered string.

{% mermaid -%}
theme: default
scale: 3
width: 75
align: center
caption: |
    An example mermaid diagram!
diagram: |
    graph TD
        A --> B
        B --> C
        A --> C
{% endmermaid %}

Repository initiated with fpgmaas/cookiecutter-poetry.

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

jinja2_mermaid_extension-1.0.0.tar.gz (5.1 kB view hashes)

Uploaded Source

Built Distribution

jinja2_mermaid_extension-1.0.0-py3-none-any.whl (6.1 kB view hashes)

Uploaded Python 3

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