{"id":4100,"library":"markdown-graphviz-inline","title":"Markdown Graphviz Inline","description":"markdown-graphviz-inline is a Python-Markdown extension that enables rendering Graphviz DOT language diagrams directly within Markdown documents. It automatically detects ````graphviz ... ```` code blocks and replaces them with inline SVG images. This library is a Python 3 fork and continuation of the original `markdown-inline-graphviz` by Cesare Morel, currently maintained under the Backstage organization. Its current version is 1.1.3, with updates occurring on an as-needed basis.","status":"active","version":"1.1.3","language":"en","source_language":"en","source_url":"https://github.com/backstage/markdown-inline-graphviz","tags":["markdown","graphviz","rendering","extension","diagrams"],"install":[{"cmd":"pip install markdown-graphviz-inline","lang":"bash","label":"Install package"}],"dependencies":[{"reason":"Required for parsing Markdown and providing the extension mechanism.","package":"Markdown"},{"reason":"Required for generating graph images from DOT language and finding the Graphviz 'dot' executable.","package":"graphviz"}],"imports":[{"note":"This library is primarily used as a string extension with the `markdown` library, not via a direct Python import of a class or function.","symbol":"markdown_inline_graphviz","correct":"import markdown\nhtml = markdown.markdown(text, extensions=['markdown_inline_graphviz'])"}],"quickstart":{"code":"import markdown\n\n# Ensure Graphviz 'dot' executable is installed on your system and in PATH.\n# For example, on Ubuntu: sudo apt-get install graphviz\n# On macOS: brew install graphviz\n\nmarkdown_text = '''\n# My Graph Report\n\nHere's a simple directed graph:\n\n```graphviz\ndigraph G {\n    A -> B;\n    B -> C;\n    C -> A;\n}\n```\n\nAnd a more complex one with different shapes:\n\n```graphviz\ndigraph hierarchy {\n    node [shape=box];\n    subgraph cluster_0 {\n        label = \"Parent Process\";\n        a0 [label=\"Task 1\"];\n        a1 [label=\"Task 2\"];\n        a2 [label=\"Task 3\"];\n    }\n    subgraph cluster_1 {\n        label = \"Child Process\";\n        b0 [label=\"Subtask 1\"];\n        b1 [label=\"Subtask 2\"];\n    }\n    a0 -> a1 -> a2;\n    a2 -> b0;\n    b0 -> b1;\n}\n```\n'''\n\nhtml_output = markdown.markdown(\n    markdown_text,\n    extensions=['markdown_inline_graphviz']\n)\n\nprint(html_output)","lang":"python","description":"Demonstrates how to parse Markdown text containing ````graphviz ... ```` blocks using the `markdown_inline_graphviz` extension and print the resulting HTML. This requires the Graphviz 'dot' executable to be installed on your system."},"warnings":[{"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.","message":"The underlying `graphviz` Python package (a dependency) requires the Graphviz `dot` executable to be installed on your system and available in the system's PATH. Without it, the extension will fail to render graphs, potentially with errors from the `graphviz` library.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure `extensions=['markdown_inline_graphviz']` is used exactly as shown in your `markdown.markdown` call.","message":"The correct extension string to use with `markdown.markdown()` is `'markdown_inline_graphviz'`. Incorrect spelling or capitalization (e.g., `markdown_graphviz_inline`) will prevent the extension from loading and processing graph blocks.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Verify behavior with existing markdown files and ensure Python 3 compatibility if migrating from the original `markdown-inline-graphviz`.","message":"This `markdown-graphviz-inline` library is a fork of the original `markdown-inline-graphviz` (by Cesare Morel) providing Python 3 compatibility and continued maintenance. While core functionality remains similar, users migrating from the older library should be aware of potential subtle behavioral differences.","severity":"gotcha","affected_versions":"Users migrating from `markdown-inline-graphviz`"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}