A tern template for mermaid diagrams
- Lua 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
Extracted from the resources repo, where the converters lived as loose Lua scripts shared through a flake input. Packaging each as its own tern template lets consumers install it with tern --update instead of depending on that flake. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_018d7Ytt5wb8uarCFsh15kVo |
||
| converters | ||
| AGENTS.md | ||
| README.md | ||
| tern.toml | ||
mermaid-template
A tern template for rendering Mermaid diagrams to SVG via mmdc.
Setup
In your project's .tern/config.toml:
[[templates]]
name = "mermaid-template"
url = "https://git.yhkze.net/tern/mermaid-template.git"
Usage
# 1. Install/update the template
tern --update
# 2. Render your diagrams
tern
# Re-render everything, including files tern has already seen
tern --force
What it does
| Step | What happens |
|---|---|
tern --update |
Clones/pulls the template and installs the converter |
tern |
Runs mmdc on .mmd files in docs/diagrams/, writing SVG to docs-html/diagrams/ |
Requirements
mmdc (the Mermaid CLI) must be on PATH. On Nix:
nix shell nixpkgs#mermaid-cli
Customizing
Paths and flags belong in your .tern/config.toml, not in the installed copy —
tern --update overwrites .tern/data/ and recomputes profiles from the
manifest:
[[templates]]
name = "mermaid-template"
url = "https://git.yhkze.net/tern/mermaid-template.git"
[templates.overrides.mermaid]
source_root = "diagrams"
output_root = "build/diagrams"
options = ["-t default -b white"]
The converter forwards options[1] verbatim to mmdc, so keep every flag in
that one string rather than splitting them across list entries.