Registry / serialization / markdown-inline-graphviz-extension

markdown-inline-graphviz-extension

JSON →
library1.1.3pypypi✓ verified 83d ago

The `markdown-inline-graphviz-extension` library is a Python Markdown extension that allows rendering of Graphviz DOT language diagrams directly within Markdown documents, replacing inline definitions with inline SVG or PNG images. It is a Python 3 fork and continuation of previous projects, designed to work seamlessly with any Python-Markdown-based static site generator. Its current version is 1.1.3, with updates occurring on an as-needed basis to ensure compatibility and address issues.

pip install markdown-inline-graphviz-extension
INSTALL
IMPORT
SIG · MARKDOWN-INLINE-GR
M
markdown-inline-graphviz-extension
serializationpythonv1.1.3
Install
1.7s avg
Import
138ms
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.1.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.141s · 18.5MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 1.7s · import 0.134s · 19MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

InlineGraphvizExtension
from markdown_inline_graphviz import InlineGraphvizExtension
import markdown

This quickstart demonstrates how to parse Markdown text containing inline Graphviz definitions using the `markdown_inline_graphviz` extension and print the resulting HTML. It is crucial to have the Graphviz 'dot' executable (and other layout engines like 'neato') installed on your system and available in your system's PATH for this extension to function correctly. The example includes both `dot` and `neato` graph definitions.

import markdown import os # Ensure Graphviz 'dot' executable is in your system's PATH # For example, on Ubuntu/Debian: sudo apt-get install graphviz # On macOS: brew install graphviz markdown_text = """ # My Document with a Graph Here is a simple graph: {% dot example.svg digraph G { A -> B; B -> C; C -> A; } %} Another graph using a different engine: {% neato another.svg node [shape=box]; A -- B; B -- C; C -- A; %} """ # Render the markdown with the inline_graphviz extension # Ensure the extension name is exactly 'markdown_inline_graphviz' try: html_output = markdown.markdown(markdown_text, extensions=['markdown_inline_graphviz']) print(html_output) except Exception as e: print(f"Error rendering markdown: {e}") print("Please ensure Graphviz is installed on your system and its executables are in your PATH.") print("You can test by running 'dot -V' or 'neato -V' in your terminal.")
Debug
Known issues
gotchaThe underlying `graphviz` Python package (a dependency) requires the Graphviz `dot` executable and other layout engines (e.g., `neato`, `fdp`) to be installed on your system and available in the system's PATH. Without these system executables, the extension will fail to render graphs, potentially with errors from the `graphviz` Python library or simply outputting empty placeholders.
fix
Install Graphviz via your system's package manager (e.g., `sudo apt-get install graphviz` on Debian/Ubuntu, `brew install graphviz` on macOS) or download from graphviz.org, and ensure its executables are in your system's PATH. Verify installation by running `dot -V` or `neato -V` in your terminal.
affects: All versions
gotchaThe correct extension string to use with `markdown.markdown()` is `'markdown_inline_graphviz'`. Incorrect spelling or capitalization (e.g., `inline_graphviz`, `Markdown_Inline_Graphviz`, `markdown_graphviz_inline`) will prevent the extension from loading and processing graph blocks, leading to unrendered graph definitions in your output HTML.
fix
Ensure `extensions=['markdown_inline_graphviz']` is used exactly as shown in your `markdown.markdown` call or `mkdocs.yml` configuration.
affects: All versions
breakingThis `markdown-inline-graphviz-extension` library is a Python 3 fork and continuation of the original `markdown-inline-graphviz` (by Steffen Prince, `sprin/markdown-inline-graphviz`). While core functionality is similar, users migrating from the older Python 2-compatible libraries should be aware of potential subtle behavioral differences or changes in required `markdown` library versions. The library explicitly targets Python 3 environments.
fix
Verify behavior with existing markdown files and ensure your environment is Python 3. If upgrading from very old versions, test thoroughly. Review release notes for specific 'Markdown 3 compatibility' fixes in versions like 1.1.3 and 1.1.1.
affects: <1.0.0 (older forks) vs. >=1.0.0 (current)
Upgrade
Version history
1.1.3latest on PyPI · released Jul 25, 2025
Audit
Dependencies
markdownrequiredRequired for parsing Markdown text and integrating the extension.
graphvizrequiredThe Python binding for Graphviz, used to generate graph data from DOT language.
Graphviz (system installation)optionalThe underlying Graphviz executable (e.g., 'dot', 'neato') must be installed on the system and available in the PATH for graphs to be rendered. This is a crucial external dependency, not a Python package.
Agent activity
6 hits · last 30 days
node
6
Resources
markdown-inline-graphviz-extension — pip install markdown-inline-graphviz-extension · libregistry