Documentation Notes
Helpers and notes for building and working on these docs.
Building .svgs from plantuml sources
.svgs from plantuml sourcesWe use a git commit hook to automatically rebuild .svg files from plantuml sources. The magic of git hooks means that no extra work is required by you after creating or editing a .puml file
Behind the scenes, this hook spins up a docker container to run the PUML server and calls ./scripts/_render_svg.mjs for each file that has changed. We use the docker version instead of the public puml server to (1) get around rate limits, and (2) ensure deterministic SVG output that is git diffable.
Creating a new PUML
Create a new
*.puml/plantumlfileAdd the file and generate the
.svg
git add . #(or the specific file you are working on)
npm run build:plantuml:diffUpdate your
.mdfile to refer to the newly created.svgfileGit add/commit
Updating an existing PUML
Make changes to an existing
*.puml/plantumlfilegit add+git commitThe pre-commit hook rebuilds the changed SVG files, and adds them before the commit
Building all .puml sources manually
.puml sources manuallyYou can also force a complete rebuild of all .puml and .plantuml sources like so:
npm install
npm run build:plantuml:alltest-svg CI/CD Step
test-svg CI/CD StepThis is a ci/cd step that ensures that the .svg files have been updated correctly, just in case something got out of sync on your branch before merging a pull request.
It runs npm run build:plantuml:all to build all of the plantuml sources and if it detects file changes, it means something went wrong with the commit hook (or you skipped it with git commit -n).
Last updated
Was this helpful?