go-typst/examples/simple
David Vogel 1aa13dbfb5
Some checks failed
test / test non-docker (1.23.x, 0.12.0) (push) Failing after 4s
test / test non-docker (1.23.x, 0.13.0) (push) Failing after 3s
test / test non-docker (1.23.x, 0.13.1) (push) Failing after 4s
test / test non-docker (1.23.x, 0.14.0) (push) Failing after 3s
test / test docker (1.23.x, ) (push) Failing after 23s
test / test docker (1.23.x, ghcr.io/typst/typst:0.14.0) (push) Failing after 15s
test / test docker (1.23.x, ghcr.io/typst/typst:v0.12.0) (push) Failing after 20s
test / test docker (1.23.x, ghcr.io/typst/typst:v0.13.0) (push) Failing after 19s
test / test docker (1.23.x, ghcr.io/typst/typst:v0.13.1) (push) Failing after 21s
Update README.md & Cleanup
2025-11-16 18:15:25 +00:00
..
main_test.go Add simple example 2025-02-27 16:08:02 +01:00
main.go Update README.md & Cleanup 2025-11-16 18:15:25 +00:00
output.pdf Add simple example 2025-02-27 16:08:02 +01:00
README.md Add simple example 2025-02-27 16:08:02 +01:00

Simple example

This example shows how to render Typst documents directly from strings in Go.

The pros and cons

The main advantage of this method is that it's really easy to set up. In the most simple case you build your Typst markup by concatenating strings, or by using fmt.Sprintf.

The downside is that the final Typst markup is only generated on demand. This means that you can't easily use the existing Typst tooling to write, update or debug your Typst markup. Especially as your your documents get more complex, you should switch to other methods.