Putting PlantUML diagrams into PR reviews
Diagrams usually get skipped during PR review because most teams keep them in Confluence or PowerPoint. Here’s how to push them through review the same way you push code.
Why we don’t put diagrams in PRs
Common excuses:
- “The diagram is part of the design phase; dev review doesn’t touch it”
- “The diagram is huge, every change touches everything, easy to miss during merge”
- “The review system can’t show the diagram; what would review mean?”
None of these hold up once you have PlantUML + GitHub/GitLab renderers.
Suggested repo layout
1 | docs/ |
One .puml file per diagram. kebab-case filenames.
Embedding in PR descriptions
1 | ## Changes |
Or use a markdown image link:
1 |  |
GitHub renders the encoded URL directly; GitLab does too. The diagram shows up in the PR description.
Make GitHub/GitLab render .puml
GitHub doesn’t render .puml source files directly — .puml is text source; it needs to be rendered to SVG/PNG first. Two approaches:
A. Commit rendered SVGs alongside (recommended)
1 | # local render |
When you change .puml, also commit the regenerated .svg. The .puml carries the diff; the .svg is the rendered artifact.
Use .gitattributes to mark SVG as diff=image so PR diffs include the diagram visually:
1 | docs/**/*.svg diff=image |
B. Render script in the repo
1 |
|
Run it in CI:
1 | - name: Render PlantUML |
This way PR diffs include SVG, and reviewers can use GitHub’s image diff viewer to see before/after.
Force diagram updates via PR template
.github/PULL_REQUEST_TEMPLATE.md:
1 | ## Changes |
Diagram presence becomes unmissable.
Reviewing the diagrams themselves
Reviewers should write:
“Why is there no arrow between step 4 and step 5 in this sequence diagram? Is it synchronous blocking or async?”
Not:
“Let’s book a meeting to talk about the login flow.”
Reviews happen in a visible, searchable, traceable text stream.
Recommended toolset
| Tool | Use |
|---|---|
PlantUML CLI (plantuml.jar) |
Local/CI SVG render |
hexo-renderer-plantuml |
Hexo blog post embed |
| GitHub Actions + PlantUML Action | Auto CI render |
| plantuml-preview.nvim / VSCode PlantUML extension | In-editor preview |
gitattributes diff=image |
PR diff auto-image |
Day-to-day workflow
What I use:
- Edit
.pumlfiles - VSCode PlantUML extension gives live preview
- Commit both
.pumland rendered.svg - CI re-renders SVG and commits back (in case local forgot)
- PR description links either plantuml.com encoded URL or local SVG
- Reviewers annotate directly on the SVG
Pitfalls
- plantuml.com rendering in PR preview is slow: PR description URLs to plantuml.com render 1-2s late in GitHub’s markdown preview. Pre-rendered SVGs avoid this.
- CJK fonts break in SVG: plantuml.jar uses the OpenJDK font by default; CJK characters often render as tofu. Pass a config file:
1
2
3java -Djava.awt.headless=true -jar plantuml.jar \
-config scripts/plantuml.cfg \
-tsvg docs/sequences/login.pumlplantuml.cfg:1
2skinparam defaultFontName "PingFang SC"
skinparam defaultFontSize 14 - Don’t split one diagram across multiple
.pumlfiles: each file should be the whole story. Splitting fragments the review surface and the reviewer loses context. - Themes vs dark mode: default theme is loud on GitHub dark.
!theme cyborgor!theme black-knighthelp on dark, but they’re ugly on white. Safest is!theme plainplus custom skinparams that work in both contexts.
- Title: Putting PlantUML diagrams into PR reviews
- Author: puml.online
- Created at : 2026-07-29 14:30:00
- Updated at : 2026-08-14 21:34:29
- Link: https://puml.online/blog/plantuml-git-pr-review-en/
- License: This work is licensed under CC BY-NC-SA 4.0.