Skip to main content

MkDocs plugin that renders Mermaid fences to hashed PNG assets

Project description

mkdocs-mermaid-images

MkDocs plugin that replaces Mermaid code fences with generated PNG images.

Requirements

You do not need to install @mermaid-js/mermaid-cli globally. The plugin runs it through npx when MkDocs builds the site.

That means the machine running the build needs:

  • node and npx available on PATH
  • network access on the first run so npx can fetch @mermaid-js/mermaid-cli if it is not already cached
  • any system dependencies required by Mermaid CLI's headless browser on that platform

For locked-down Linux CI environments, you may also need to disable Chromium sandboxing. The demo site does this with no_sandbox: !ENV [MKDOCS_MERMAID_IMAGES_NO_SANDBOX, false], and the GitHub Actions workflow sets that environment variable only in CI.

Demo site

A minimal demo site lives in examples/demo. It has a single page with a few Mermaid diagrams so you can verify the plugin renders them into image assets during the build.

Run it from the repository root:

uv sync
uv run mkdocs serve -f examples/demo/mkdocs.yml

Or use the Makefile targets:

make demo-serve

Or build the static site:

uv run mkdocs build -f examples/demo/mkdocs.yml

You can also run the repository checks from the root:

make ty
make test
make check

The generated files will be written to examples/demo/site/, and the rendered diagram images will appear under examples/demo/site/assets/mermaid/.

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

mkdocs_mermaid_images-0.1.0.tar.gz (38.0 kB view details)

Uploaded Source

Built Distribution

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

mkdocs_mermaid_images-0.1.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file mkdocs_mermaid_images-0.1.0.tar.gz.

File metadata

  • Download URL: mkdocs_mermaid_images-0.1.0.tar.gz
  • Upload date:
  • Size: 38.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for mkdocs_mermaid_images-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5222654b5c60eec6826419d6d996dfe67874ac5bc07e86c3cfa35ada7a7622e5
MD5 1f63ac768aa8af0156ea035ba30cd7ce
BLAKE2b-256 226ec666a6f932c22b28cf31e881ad383c748127e5798f61a04b83e4b64ebb5d

See more details on using hashes here.

File details

Details for the file mkdocs_mermaid_images-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mkdocs_mermaid_images-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for mkdocs_mermaid_images-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aa3c1bbb389f8b483b89c05eb40d2e4adb5573a1a4814d112e2c34b90ec93dcd
MD5 ab5c6d9b14d5e8b76f3b27aa7249cc7a
BLAKE2b-256 ee11a2441aa4a0323a64d60f610bc25c276ccf3e3f2b7ef20cf0e9c527a6ffcc

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