This is a bare-bone typst plugin, written in Zig.
To compile this example, you need the zig compiler. Then, run the command
zig build-lib hello.zig -target wasm32-freestanding -dynamic -rdynamic -O ReleaseSmall
If you want to build with WASI, use the wasm32-wasi
target:
zig build-lib hello.zig -target wasm32-wasi -dynamic -rdynamic -O ReleaseSmall -femit-bin=hello-wasi.wasm
Then, stub the resulting binary:
pushd ../../wasi-stub
cargo run -- ../examples/hello_zig/hello-wasi.wasm -o ../examples/hello_zig/hello-wasi.wasm
popd
Simply run typst compile hello.typ
, and observe that it works !