graphviz
Graphviz DOT Diagram Generator
Important: Use
```dotas the code fence identifier, NOT```graphviz.
Quick Start: Choose digraph (directed) or graph (undirected) → Define nodes with attributes (shape, color, label) → Connect with -> or -- → Set layout (rankdir, spacing) → Wrap in ```dot fence. Default: top-to-bottom (rankdir=TB), cluster names must start with cluster_, use semicolons.
Critical Syntax Rules
Rule 1: Cluster Naming
❌ subgraph backend { } → Won't render as box
✅ subgraph cluster_backend { } → Must start with cluster_
Rule 2: Node IDs with Spaces
❌ API Gateway [label="API"]; → Invalid ID
✅ "API Gateway" [label="API"]; → Quote the ID
✅ api_gateway [label="API Gateway"]; → Use underscore ID
Rule 3: Edge Syntax Difference
digraph: A -> B; → Directed arrow
graph: A -- B; → Undirected line
Rule 4: Attribute Syntax
❌ node [shape=box color=red] → Missing comma
✅ node [shape=box, color=red]; → Comma separated
Rule 5: HTML Labels
✅ shape=plaintext for HTML labels
✅ Use < > not " " for HTML content
Common Pitfalls
| Issue | Solution |
|---|---|
| Nodes overlapping | Increase nodesep and ranksep |
| Poor layout | Change rankdir or add {rank=same} |
| Edges crossing | Use splines=ortho or adjust node order |
| Cluster not showing | Name must start with cluster_ |
| Label not displaying | Check quote escaping |
Output Format
```dot
digraph G {
[diagram code]
}
```
Related Files
For advanced layout control and complex styling, refer to references below:
- syntax.md — Layout control (rankdir, splines, rank), HTML labels, edge styles, cluster subgraphs, and record-based nodes
More from xicilion/markdown-viewer-extension
mermaid
Create flowcharts, sequence diagrams, state machines, class diagrams, Gantt charts, mindmaps, and more. Best for process flows, API interactions, system architecture, and technical documentation. NOT for data-driven charts (use vega) or quick KPI visuals (use infographic).
14vega
Create data-driven charts with Vega-Lite (simple) and Vega (advanced). Best for bar, line, scatter, heatmap, area charts, and multi-series analytics. Use when you have numeric data arrays needing statistical visualization. Vega for radar charts and word clouds. NOT for process diagrams (use mermaid) or quick KPI cards (use infographic).
8infographic
Create beautiful infographics with pre-designed templates. Best for KPI cards, timelines, roadmaps, step-by-step processes, A vs B comparisons, SWOT analysis, funnels, org trees, pie/bar charts. Use when you need quick visual impact with 4-8 items. Simple YAML-like syntax. NOT for complex data analysis (use vega) or technical flowcharts (use mermaid).
7canvas
Create spatial node-based diagrams with free positioning. Best for mind maps, knowledge graphs, concept maps, and planning boards where precise spatial layout matters. Use JSON format with x/y coordinates. NOT for sequential flows (use mermaid) or data charts (use vega).
6