Diagrams
Calepin can run text-to-diagram engines from the same chunk system used for Python, R, and other computational code. Diagram chunks keep the source for figures in the Typst document, so prose, references, and diagram definitions stay together.
Diagram engines are stateless external tools. They convert source text to SVG, and Calepin renders the SVG as a figure. Give a diagram chunk a label and fig-caption when it should be numbered and cross-referenced.
Mermaid
Mermaid is a text-based diagramming tool; learn more at mermaid.js.org.
%%{init: {"htmlLabels": false}}%%
flowchart LR
Source["Typst document"] --> Query["Calepin query"]
Query --> Execute["Run chunks"]
Execute --> Render["Typst render"]Graphviz DOT
Graphviz DOT is a graph description language used by Graphviz; learn more at graphviz.org.
digraph {
rankdir=LR
Draft -> Review -> Publish
Review -> Draft [label="revise"]
}TikZ
TikZ is a LaTeX package for creating vector graphics; learn more at tikz.dev.
\begin{tikzpicture}
\draw[thick, blue] (0,0) -- (2,1) -- (4,0);
\fill[red] (2,1) circle (2pt);
\end{tikzpicture}D2
D2 is a text-to-diagram language; learn more at d2lang.com.
direction: right
client -> api: request
api -> worker: job
worker -> database: write