ai-figure.
v0.2 — 10 diagram types

SVG diagrams from
plain markdown

Single function call. No coordinates, no config hell. Just describe your diagram and get beautiful, self-contained SVG.

Streaming-safe

Partial or empty input returns a valid empty SVG. Works perfectly with AI streaming responses.

📐

10 diagram types

Flow, tree, arch, sequence, quadrant, gantt, state, ER, timeline, swimlane.

✍️

Zero coordinates

Describe your diagram in markdown — layout is computed automatically.

🎨

Nine palettes

default, antv, drawio, figma, vega, mono-blue, mono-green, mono-purple, mono-orange.

See it in action

Write markdown on the left, get SVG on the right.

Input
figure flow
direction: LR
palette: antv
title: CI Pipeline
code[Push Code] --> lint{Lint?}
lint --> test[Run Tests]: pass
lint --> fix((Fix)): fail
fix --> code
test --> build[Build Image]
build --> deploy[Deploy]
group Pipeline: code, lint, test, build
Output
CI Pipeline Pipeline pass fail Push Code Lint? Run Tests Fix Build Image Deploy
Install
npm install ai-figure
Usage
import { fig } from 'ai-figure';

const svg = fig(`
  figure flow
  direction: LR
  A[Start] --> B[End]
`);

// Browser
document.getElementById('chart').innerHTML = svg;

// Node.js
import { writeFileSync } from 'fs';
writeFileSync('diagram.svg', svg);