English · 中文
Draw data-structure and computer-systems diagrams in Typst from a few lines of text. The style is plain and traditional: square corners and thin black lines, with restrained color. A grayscale palette keeps every figure clear in black-and-white printing.
Labels are typeset by Typst itself, so diagrams align with any font and match your document.
#import "@preview/dsviz:0.2.2": ds
// Every ```ds block becomes a diagram.
#show raw.where(lang: "ds"): ds
```ds
bintree thread=in
A
B
_
D
C
```The first line names the kind and its options; the rest describes the structure. You can also call the function directly:
#ds(width: 5cm, spacing: 1.2)[```
wave grid=on bits=1 0 1
CLK: c c c
Data: 10 01 10
```]Diagrams use color by default. Pass palette: "gray" for black-and-white printing, per diagram or for a whole document:
#show raw.where(lang: "ds"): ds.with(palette: "gray")| Kinds | |
|---|---|
| Trees | tree forest bintree rbtree btree bplus |
| Linear | list array stack ring matrix table |
| Graphs | graph digraph orthlist multilist |
| Systems | fields pipeline gantt ladder wave block |
Full syntax and ds parameters: docs/syntax.md.
Sources are in examples/.
Requires Rust with the wasm32-unknown-unknown target.
make wasm # build the plugin into src/dsviz.wasm
make test # unit tests, gallery and examples
make images # regenerate docs/images/Release notes: CHANGELOG.md. License: MIT.




