Skip to main content

Diagram Renderer

A comprehensive diagram rendering service supporting Mermaid, PlantUML, and Graphviz diagrams with an interactive web interface:

  • Streamlit Dashboard - Interactive web interface for diagram rendering

Features

  • Automatic diagram type detection (Mermaid, PlantUML, Graphviz)
  • Self-contained rendering - All JavaScript libraries hosted locally
  • Static Mermaid.js assets (version controlled, 2.8MB)
  • VizJS for Graphviz/DOT rendering (locally hosted, 1.9MB)
  • PlantUML to DOT conversion and rendering
  • Multiple themes for Mermaid diagrams
  • Interactive Streamlit dashboard, FastAPI web app, and MCP server
  • No external CDN dependencies - Works offline
  • AI Assistant Integration - MCP server for Claude Desktop and other AI tools

Installation

Install from PyPI:

# Using uv (recommended)
uv add diagram-renderer

# Using pip
pip install diagram-renderer

For development setup:

git clone https://github.com/djvolz/diagram-renderer.git
cd diagram-renderer
uv install

Usage

Examples

The examples/ directory contains four demonstration applications:

Streamlit Dashboard - Interactive web interface:

uv sync --extra dashboard
# Run directly
uv run --extra dashboard python -m streamlit run examples/dashboard.py
# Or use the convenience script
uv run --extra dashboard ./examples/run-dashboard.py

FastAPI Web App - REST API and web interface:

uv sync --extra webapp
uv run --extra webapp python examples/cli.py webapp
# or directly: uv run --extra webapp python examples/webapp.py

MCP Server - AI assistant integration via Model Context Protocol:

uv sync --extra mcp
uv run --extra mcp python examples/cli.py mcp
# or directly: uv run --extra mcp python examples/mcp_server.py

Command Line Interface - Batch processing and automation:

# Render diagram from file
uv run python examples/cli.py render diagram.mmd

# Quick inline rendering
uv run python examples/cli.py quick "graph TD; A-->B"

# Serve a diagram with HTTP server
uv run python examples/cli.py serve diagram.mmd

# Show examples and help
uv run python examples/cli.py examples
uv run python examples/cli.py --help

Supported Diagram Types

The visual-regression baselines cover the following diagram families:

Mermaid

  • Flowchart, Sequence, Class, State, and ER diagrams
  • User Journey, Timeline, Requirement, and C4 Context diagrams
  • Quadrant Charts, Pie Charts, and Gantt Charts
  • Git Graphs plus beta features: XY Chart, Sankey, and Block diagrams

PlantUML

  • Sequence, Class, Use Case, Component, and State diagrams
  • Deployment, Object, and Network diagrams

Graphviz (DOT)

  • Directed and Undirected graphs, Flowcharts, and Dependency graphs
  • Organizational Charts, State Machines, Network Diagrams, and Cluster diagrams

Visual Gallery

Interactive screenshots from our baseline suite are available below. Expand any section to preview the rendered output.

Mermaid Gallery

Mermaid Flowchart Mermaid Sequence Diagram Mermaid Class Diagram
Mermaid State Diagram Mermaid ER Diagram Mermaid User Journey
Mermaid Timeline Mermaid Requirement Diagram Mermaid C4 Context Diagram
Mermaid Quadrant Chart Mermaid Pie Chart Mermaid Gantt Chart
Mermaid Git Graph Mermaid XY Chart Mermaid Sankey Diagram
Mermaid Block Diagram

PlantUML Gallery

PlantUML Sequence Diagram PlantUML Class Diagram PlantUML Use Case Diagram
PlantUML Component Diagram PlantUML State Diagram PlantUML Deployment Diagram
PlantUML Object Diagram PlantUML Network Diagram

Graphviz Gallery

Graphviz Directed Graph Graphviz Undirected Graph Graphviz Flowchart
Graphviz Dependency Graph Graphviz Cluster Diagram Graphviz State Machine
Graphviz Network Diagram Graphviz Organizational Chart

Configuration

Mermaid Themes

  • default - Default theme
  • base - Base theme
  • dark - Dark theme
  • forest - Forest theme
  • neutral - Neutral theme

Development

The main components are:

  • diagram_renderer/ - Core diagram rendering logic and renderers
  • st_diagram.py - Streamlit diagram component wrapper
  • examples/cli.py - Command-line interface and app launcher
  • examples/dashboard.py - Streamlit web interface
  • examples/webapp.py - FastAPI REST API and web interface
  • examples/mcp_server.py - MCP server for AI assistant integration
  • diagram_renderer/renderers/static/js/ - Local JavaScript libraries
    • mermaid.min.js (2.8MB) - Mermaid diagram rendering
    • viz-full.js (1.9MB) - Graphviz/DOT rendering
    • viz-lite.js (11KB) - Lightweight VizJS alternative

Demo

Input:

flowchart LR
    A[diagram-renderer] --> B{Auto-detect}
    B -->|Mermaid| C[Mermaid.js]
    B -->|PlantUML| D[PlantUML → DOT]
    B -->|Graphviz| E[VizJS]
    C --> F[Interactive HTML]
    D --> F
    E --> F
    F --> G[📱 Responsive]
    F --> H[🖼 PNG Export]
    F --> I[🔍 Zoom/Pan]

Output: The generated HTML includes:

  • 🔍 Interactive zoom and pan controls
  • 📱 Responsive design
  • 🖼 PNG export functionality
  • 🎨 Automatic diagram type detection
  • 🔒 Self-contained - All JS libraries included locally (no CDN dependencies)
  • ⚡ Two output modes - Lightweight external JS (14KB) or fully embedded (4.7MB)

Try it yourself:

uv run python examples/cli.py quick "graph TD; A-->B-->C"

Examples

Mermaid Flowchart

flowchart TD
    A[Start] --> B{Decision}
    B -->|Yes| C[Process A]
    B -->|No| D[Process B]
    C --> E[End]
    D --> E

PlantUML Class Diagram

@startuml
class Animal {
  +String name
  +int age
  +makeSound()
}
class Dog {
  +String breed
  +bark()
}
Animal <|-- Dog
@enduml

Graphviz DOT Diagram

digraph G {
    A -> B;
    B -> C;
    C -> A;
}

Metadata

Release files for diagram-renderer 2025.9.24.103

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for diagram-renderer 2025.9.24.103
File Size Uploaded
diagram_renderer-2025.9.24.103.tar.gz 1.4 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for diagram-renderer 2025.9.24.103
File Interpreter ABI Platform
diagram_renderer-2025.9.24.103-py3-none-any.whl Python 3 none any Details

Total release size: 2.7 MB

Release files / diagram_renderer-2025.9.24.103.tar.gz

Download URL diagram_renderer-2025.9.24.103.tar.gz
Size 1.4 MB
Tags Source
SHA-256 checksum
How to use checksums
f392b8c642f5a2a041dca190ccf8780fde1abc6f376836703792127bc781d209
BLAKE2b-256 checksum
How to use checksums
e792af2c8c8ba2efc2a1fc1fcc605d5c28f2f09e3cfa607bb9e67e4ddf80d9ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.22

Release files / diagram_renderer-2025.9.24.103-py3-none-any.whl

Download URL diagram_renderer-2025.9.24.103-py3-none-any.whl
Size 1.4 MB
Tags Python 3
SHA-256 checksum
How to use checksums
232a50fbec3aa3bd3b72a770b5fa7e1ffcaccd17b9b78fbf2f4437e4d37d91e3
BLAKE2b-256 checksum
How to use checksums
daada7c44925a5853e168e1596bf2ffc63070a4d53028c4aa397092c4d2a861a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.22

Release history Release notifications | RSS feed

This release

2025.9.24.103 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page