A Typst package for rendering Pikchr diagrams directly in your Typst documents.
Pikchr (pronounced like "picture") is a PIC-like markup language for diagrams in technical documentation. Kip brings Pikchr to Typst with a simple, elegant interface.
Why "Kip"? It's "Pik" backwards - a playful nod to the Pikchr language! 📐
- ✅ Render Pikchr diagrams as SVG directly in Typst
- ✅ No external dependencies - uses WebAssembly plugin
- ✅ Fast and lightweight (~125KB WASM module)
- ✅ Works in Typst CLI (tested with Typst 0.12+)
- ✅ Simple, intuitive API
|
|
|
| Build Process Flowchart | SQLite Architecture | Swimlanes Timeline |
|
|
|
| Syntax Railroad Diagram | Version Control Graph | Impossible Trident |
Click on an example image to see the code. Examples from pikchr.org.
- Download or clone this package
- Place it in your Typst local packages directory:
- Windows:
%APPDATA%\typst\packages\local\kip\0.1.0\ - macOS:
~/Library/Application Support/typst/packages/local/kip/0.1.0/ - Linux:
~/.local/share/typst/packages/local/kip/0.1.0/
- Windows:
Place this directory next to your Typst document and import it directly:
#import "kip/lib.typ": kip#import "@local/kip:0.1.0": kip
#kip(```
box "Start"
arrow
circle "End" fit
```)#kip("box \"Hello\" \n arrow \n circle \"World\" fit")#kip(arrow right 200% box "Process" fit arrow right 200%
width: 400pt
)
#kip(```
box "Start"
arrow
box "Process"
arrow
circle "End" fit
```)#kip(```
circle "Idle" fit
arrow right 150% "start" above
circle "Active" fit
arrow right 150% "finish" above
circle "Done" fit
```)#kip(```
arrow right 200% "Input"
box rad 10px "Processor" fit
arrow right 200% "Output"
```)#kip(```
box "Frontend" width 3cm fit
arrow down 50%
box "API Layer" width 3cm fit
arrow down 50%
box "Database" width 3cm fill lightblue fit
```)Renders a Pikchr diagram from the provided markup code.
Parameters:
code(string or content): The Pikchr markup code (can be a string or raw block)width(length, auto): Optional width constraintheight(length, auto): Optional height constraintfit(string): How to fit the image ("contain", "cover", "stretch")
Returns: An image element containing the rendered diagram
For backwards compatibility and convenience:
pikchr()- alias forkip()render()- alias forkip()
All three functions work identically:
#import "@local/kip:0.1.0": kip, pikchr, render
#kip("box \"A\"") // Primary function
#pikchr("box \"B\"") // Alias
#render("box \"C\"") // AliasFor complete Pikchr syntax and examples, visit:
If you need to rebuild the WASM module (e.g., for updates or modifications), see the build-scripts/BUILD.md file.
- The plugin is pure (stateless) - each diagram is rendered independently
- Some very complex Pikchr features might have rendering differences
- Currently only supports light mode rendering
- Pikchr: BSD-style license (see pikchr.org)
- Kip plugin wrapper: MIT License
Contributions are welcome! Please feel free to submit issues or pull requests.
- Pikchr created by D. Richard Hipp
- Inspired by diagraph Typst plugin
- Uses wasm-minimal-protocol for plugin interface
Made with ❤️ for the Typst community