Skip to content

Getting started ​

yuhwa turns a few lines of text into an SVG diagram. This page takes you from nothing to a rendered diagram, editor support and diagrams in your docs in about five minutes.

Try it in the browser ​

No install needed: open the visual editor, type on the left and the diagram updates on the right. Your diagrams stay in local storage. Import converts Mermaid or JSON, Share copies a link with the source in the URL.

Every diagram on this site has an Open in editor link in its corner.

Install ​

yuhwa needs Node.js 22 or later.

sh
npm install -g yuhwa
yu --version   # `yuhwa` works too
sh
pnpm add -g yuhwa
yu --version   # `yuhwa` works too

Prefer not to install globally? Put npx yuhwa (or pnpm dlx yuhwa) in front of every command instead of yuhwa, or add it to a project with npm install -D yuhwa (or pnpm add -D yuhwa).

Your first diagram ​

Create a file hello.yu:

yuhwa diagramyuhwa diagramEdit
yuhwa
web "Web app" -> api "API" -> db "Postgres" [cylinder]
api -> cache "Redis": read-through [dashed]

Render it:

sh
yuhwa render hello.yu -o hello.svg

Open hello.svg in a browser. That's it.

What the two lines mean:

  • Each line is one statement.
  • web "Web app" declares a node: an id (web) and a label ("Web app"). A one-word node needs no label: web -> api.
  • -> draws an edge. a -> b -> c makes two.
  • Props go in square brackets: [cylinder]. A bare value names its key, so [cylinder] means [shape: cylinder].
  • Edge labels and edge props go after a colon: : read-through [dashed].

Check for mistakes ​

yuhwa check validates a file without rendering it. Misspell a colour, say db "Postgres" [cylinder, color: bleu], and check:

sh
$ yuhwa check hello.yu
hello.yu:1: warning: Unknown color "bleu" (did you mean "blue"?)
hello.yu: ok (yuhwa, 1 diagnostic(s))

Errors exit with status 1, so check works in CI and pre-commit hooks. Warnings do not fail, but they point at real mistakes: fix them too.

Edit it visually ​

sh
yuhwa edit hello.yu

This opens the editor on your file. Drag boxes, bend edges, move labels. ⌘S (Ctrl+S) saves back to hello.yu; hand-placed positions go into a small layout { } block at the end. See Visual editor.

Grow the diagram ​

Add colour, groups and a direction. Classes (.svc) name a look once:

OrdersOrdersEdit
yuhwa
title: Orders
direction: down

.svc [blue]

group app "Application" {
  api "API" .svc
  worker "Worker" .svc
    sub: jobs
}

api -> worker: enqueue
api, worker -> db "Postgres" [cylinder, amber]
  • title: and direction: are settings, one per line.
  • group id "Label" { … } draws a box around nodes.
  • An indented line under a node adds a prop: sub: jobs is a second line of text.
  • a, b -> c draws an edge from each.

The cheatsheet fits the whole language on one page. Syntax has every statement and prop.

More than boxes and arrows ​

Sequence diagrams, timelines, charts, git histories, mind maps, Gantt charts, quadrants and kanban boards are panels. They go in the same file and line up next to the graph:

Release 1.1Release 1.1Edit
yuhwa
title: Release 1.1
web "Web" [blue] -> api "API" [blue]

git release "Branches" {
  commit "1.0" [tag: v1.0]
  branch feature/search
  commit "search"
  checkout main
  merge feature/search [tag: v1.1]
}

Diagram types has a page for every panel kind, and Combining diagrams covers arranging them and import, which splits a diagram over several files. The examples show them in use.

Set up your editor ​

Get diagnostics, completion, hover and rename while you type:

  • VS Code, Cursor, VSCodium: install the yuhwa extension. It bundles the language server. See VS Code.

  • Neovim, Helix, Sublime, Emacs, JetBrains, Vim, Kate: install the language server and add a few lines of config:

    sh
    npm install -g yuhwa
    sh
    pnpm add -g yuhwa

    Then follow the snippet for your editor in Language server.

Put diagrams where you need them ​

you wantuse
diagrams in a GitHub or GitLab READMEyuhwa md writes SVGs next to the file
diagrams in a docs site (VitePress, VuePress, Starlight, Docusaurus, Vocs, Nextra …)a build plugin, one line of config
diagrams on any web pagethe script tag or web component
.yu files in a React, Vue or Svelte appthe Vite plugin
diagrams in wikis, chat or issue trackersthe render service and plain image URLs
SVG from JavaScriptrender()
an AI agent that writes diagramsyuhwa guide and yuhwa check --json
to move off Mermaidyuhwa convert

The fastest of these, for a README:

md
```yuhwa
client "Client" -> server "Server": HTTPS
```
sh
yuhwa md README.md

The block becomes a hidden comment and an image link to diagrams/readme-1.svg, which GitHub shows like any picture. Edit the comment and run yuhwa md again to update it.

Released under the MIT License.