This page gets you from an empty directory to a rendered diagram, a CI check, and a
Markdown embed. It assumes puml is installed; see install.md first if
puml --version does not work.
puml --versionCreate hello.puml:
cat > hello.puml <<'EOF_DIAGRAM'
@startuml
title First puml diagram
Alice -> Bob: Hello
Bob --> Alice: Ack
note right of Bob
Rendered locally by puml.
end note
@enduml
EOF_DIAGRAM@startuml and @enduml delimit the diagram block. The default dialect is auto, so
PlantUML-compatible files, PicoUML files, supported Mermaid fences, and Markdown fence
labels can select the frontend automatically.
puml hello.pumlBy default, puml writes hello.svg next to hello.puml. SVG is the best default for
documentation because it is vector, deterministic, easy to diff, and renders inline in
most Markdown and static-site workflows.
To choose the output path:
puml hello.puml -o diagrams/login.svgTo write SVG to stdout:
puml hello.puml -o - > hello.svgFor PlantUML-compatible stdin-to-stdout mode, use --pipe:
cat hello.puml | puml --pipe > hello.svgTo inspect include and macro expansion without rendering, use --preproc:
puml --preproc hello.puml--pipe does not accept a positional input file or -o; it always reads stdin and
writes stdout.
puml --format png hello.puml # writes hello.png
puml --format jpg hello.puml # writes hello.jpg
puml --format webp hello.puml # writes hello.webp
puml --format pdf hello.puml # writes hello.pdf
puml --format html hello.puml # writes hello.html
puml --format txt hello.puml # writes hello.txt
puml --format utxt hello.puml # writes hello.utxt--output-format is accepted as an alias for --format. PlantUML-style aliases
such as -thtml, -tpng, -ttxt, and -tutxt are also accepted for supported
formats. LaTeX aliases (-tlatex, -tlatex:nopreamble) are parsed for parity but
currently return a deterministic unsupported-format diagnostic.
For PlantUML-compatible batch selection, --pattern filters lint/check file
paths after --lint-input and --lint-glob expansion:
puml --check --lint-glob 'docs/**/*.puml' --pattern '/sequence/'Use --extract to split a multi-diagram source file into deterministic .puml
files without rendering:
puml --extract batch.pumlPNG defaults to 96 DPI. Increase it for high-DPI screenshots or docs uploads:
puml --format png --dpi 192 hello.pumlHTML output is self-contained and embeds the SVG inline.
Use --check when you only want parsing and normalization:
puml --check hello.pumlExit code 0 means the diagram is valid. Exit code 1 means puml found a syntax or
semantic diagnostic. Exit code 2 is an I/O problem, and exit code 3 means an internal
error that should be reported.
Check many files at once:
find . -name '*.puml' -not -path './target/*' -exec puml --check {} +You can also use explicit lint inputs and globs:
puml --check --lint-input docs/architecture.puml
puml --check --lint-glob 'docs/**/*.puml' --lint-report jsonRender the SVG and reference it from Markdown:
## Login flow
Commit both files:
git add hello.puml hello.svgThe .puml source is what humans edit. The SVG is the reviewable artifact that GitHub
and most static sites can display without running a renderer.
If your diagrams live inside Markdown, use fenced blocks:
```puml
@startuml
Alice -> Bob: Hello
@enduml
```Validate every supported diagram fence in a Markdown file:
puml --from-markdown --check README.mdSupported fence labels include puml, plantuml, uml, picouml, and selected
Mermaid labels.
Local file includes work for file inputs. For stdin input, tell puml where includes
should resolve from:
cat hello.puml | puml --include-root . -o - > hello.svgURL includes are disabled by default so a render does not unexpectedly read the network
or local file:// URLs. Opt in only when your workflow needs it:
puml --allow-url-includes diagram-with-remote-include.pumlThese commands are useful when a diagram does not render the way you expect:
puml --dump ast hello.puml
puml --dump model hello.puml
puml --dump scene hello.puml
puml stats hello.puml
puml stats --format json hello.puml
puml count --by-kind hello.pumlFor CI and support reports, capture environment information:
puml env
puml env --format json- CI integration for GitHub Actions, GitLab CI, and pre-commit.
- Comparison for PlantUML and Mermaid tradeoffs.
- FAQ for compatibility, PDF, includes, and bug reports.
- Examples gallery for the current rendered corpus.
- CLI reference for the full flag list.