yuhwa
Text diagrams that look good and stay where you put them.
A few lines of text become a clean SVG. A friendlier alternative to Mermaid,
with a visual editor that writes your tweaks back into the source.

Try it in the browser ·
Docs ·
Syntax ·
Examples
title: How **yuhwa** works
subtitle: one text file: graphs, windows, charts, sequences and more
direction: right
panels: wrap
legend: .tool yuhwa | .you You | --> live | ..> writes back
footer: `npx yuhwa render` | 0 runtime deps | light + dark | {green: 0 diagnostics}
.tool [blue]
.you [purple]
src "1. Write text" .you [frame: window diagram.yu] {
web -> api -> db
db [cylinder, amber]
api -> cache: read [dashed]
}
group yuhwa "yuhwa" [blue, dashed] {
cli "2. Render" .tool [frame: terminal ~/docs, meta: 1ms] {
$$ yuhwa render diagram.yu
✓ parse || [[green: ok]]
✓ layout || [[green: ok]]
✓ route || [[green: ok]]
}
lsp "Language server" .tool [hexagon, sub: "check, hover, format"]
}
site "3. Ship the SVG" [frame: browser docs.example.com, green] {
stat: 0 deps | 12 themes | 100% text
---
spark green: 3 5 4 6 8 7 9 12
}
edit "Tweak visually" [frame: window yuhwa edit, amber] {
drag boxes || [[green: on]]
bend edges || [[green: on]]
recolour || [[green: on]]
}
src -> cli
src -> lsp: as you type
cli -> site: SVG [flow]
cli --> edit: live preview
edit ..> src: "writes layout { }"
sequence save "Saving a drag" [numbered] {
actor you "You" [purple]
you -> editor: drag a box
editor -> file: write layout { }
file --> editor: re-render
}
chart speed "Render time" [type: column, unit: ms] {
checkout [blue]: 0.6
this picture [purple]: 1.0
showcase [green]: 2.7
}
mindmap kinds "One language" {
yuhwa
graphs
panels
sequence
gantt
kanban
cards
}
kanban plan "Docs to draw" {
Todo
- auth flow
- deploy pipeline
Doing
- login sequence
Done
- architecture
- README hero
}
timeline ship "Ship it" [direction: right] {
write [purple]: source
check [blue]: 0 errors
tweak [amber]: drag
render [green]: SVG
}
Get started
1. Try it without installing. Open the
visual editor, paste the source of the picture
above and change something. Drag a box and watch the source update.
2. Render your first diagram. No install needed: npx or pnpm dlx
fetch the CLI (Node.js 22+):
echo 'web "Web app" -> api "API" -> db "Postgres" [cylinder]' > hello.yu
npx yuhwa render hello.yu -o hello.svg # npm
pnpm dlx yuhwa render hello.yu -o hello.svg # pnpm
3. Edit it visually and check it:
npx yuhwa edit hello.yu # visual editor, saves back to the file
npx yuhwa check hello.yu # diagnostics, exit 1 on errors
# pnpm: pnpm dlx yuhwa edit hello.yu, pnpm dlx yuhwa check hello.yu
4. Keep it around. Install globally to drop the npx or pnpm dlx, or add it to a
project:
npm install -g yuhwa # adds the `yu` and `yuhwa` commands
pnpm add -D yuhwa # or: npm install -D yuhwa
The syntax in 30 seconds
direction: right // a setting
.svc [blue] // a class
api "Orders API" .svc // a node: id, label, class
db [cylinder, amber] // props in brackets
api -> db: SQL [dashed] // an edge with a label and props
group core "Core" { api } // a group
Arrows: -> solid, --> dashed, ..> dotted, => thick, <-> both ways.
Full reference: syntax ·
cheatsheet.
Why yuhwa
- Looks good with zero styling. Clean auto-layout, curved routing, soft
colours. Twelve built-in themes, or define your own in a
theme { } block.
- Layout you control. Drag boxes and bend edges in the visual editor.
Positions land in the source as a small
layout { } block, so the diagram
stays put on every re-render and in every diff.
- One language, every diagram. Flowcharts, sequence, timeline, gantt,
kanban, mindmap, quadrant, file trees, git history and charts, side by side
in one file.
- Built for docs. Plugins for VitePress, Astro, Docusaurus, VuePress, MDX
and more. Light and dark variants, and a broken diagram fails the build.
- Built for AI agents.
yuhwa guide prints the language reference.
yuhwa check --json returns diagnostics that name the fix.
- Speaks Mermaid. Mermaid flowcharts render as-is and convert to yuhwa.
- Small and deterministic. TypeScript, no runtime dependencies, same
input gives the same SVG.
Use it anywhere
In the browser
<script src="https://cdn.jsdelivr.net/npm/yuhwa/dist/yuhwa.iife.js"></script>
<yuhwa-diagram>web -> api -> db [shape: cylinder]</yuhwa-diagram>
From JavaScript
import { render } from 'yuhwa';
const { svg, diagnostics } = render('a -> b -> c', { theme: 'midnight' });
render() never throws. Problems come back as diagnostics with line, message and severity.
In Markdown on GitHub or GitLab: npx yuhwa md README.md (or pnpm dlx yuhwa md README.md) renders every
```yuhwa (or ```yu) block to an SVG file and links it in (details).
In docs sites: pnpm add -D yuhwa, write ```yuhwa blocks, get SVG
figures at build time.
| site generator |
plugin |
| VitePress, Eleventy, any markdown-it |
yuhwa/markdown-it |
| VuePress 2 |
yuhwa/vuepress |
| Astro, Starlight |
yuhwa/astro |
| Docusaurus, Vocs, Nextra, Fumadocs, Rspress, any MDX |
yuhwa/remark |
| ironmark |
yuhwa/ironmark |
| Vite apps (React, Vue, Svelte, Solid) |
yuhwa/vite |
| Docsify, Hugo, Jekyll, plain HTML |
the script tag |
VitePress, for example:
// .vitepress/config.ts
import { defineConfig } from 'vitepress';
import yuhwa from 'yuhwa/markdown-it';
export default defineConfig({
markdown: { config: (md) => md.use(yuhwa) },
});
Add import 'yuhwa/style.css' to .vitepress/theme/index.ts. Other tools:
how the plugins work and
anything else.
Also: an HTTP render service for <img src> URLs.
For AI agents
npx yuhwa guide # language reference, written for agents
npx yuhwa check x.yu --json # diagnostics that name the fix
# pnpm: pnpm dlx yuhwa guide, pnpm dlx yuhwa check x.yu --json
Point your agent at yuhwa guide, let it write source, loop on check --json
until clean. The docs site also serves llms.txt and llms-full.txt.
Rules-file and skill snippets: AI guide.
Editor support
yuhwa-lsp ships with the yuhwa package: diagnostics, quick fixes,
completion, hover, rename, formatting and semantic colouring.
- VS Code, Cursor, VSCodium: the extension bundles the server (source in
packages/vscode).
- Zed: extension in
packages/zed.
- Neovim, Helix, Sublime, Emacs, JetBrains, Vim, Kate: point the editor at
yuhwa-lsp --stdio for .yu files.
Per-editor config: editor setup.
Contributing
pnpm install
pnpm dev # visual editor with hot reload
pnpm docs:dev # docs site
pnpm check # lint, format, typecheck, tests, build (what CI runs)
| path |
contents |
packages/core |
library, CLI, language server: parser, layout, router, SVG renderer, plugins, integrations |
packages/vscode |
VS Code extension and TextMate grammar |
packages/tree-sitter |
tree-sitter grammar |
packages/zed |
Zed extension |
apps/editor |
visual editor (Vite), served by yuhwa edit |
apps/docs |
docs site (VitePress) |
License
MIT