go-typst/examples/simple
David Vogel c3876b340b Rename Variable* to Value*
- Rename MarshalVariable to MarshalValue
- Rename NewVariableEncoder to NewValueEncoder
- Rename VariableEncoder to ValueEncoder
- Rename VariableMarshaler to ValueMarshaler
- Rename MarshalTypstVariable to MarshalTypstValue

There are now wrappers which ensure compatibility with code that still uses some of the old functions/types.

- Improve image_test.go by adding an assertion
- Rename all occurrences of Variable to Value
- Remove "TODO: Handle images..." as that's already working with the image wrapper
- Update README.md
2025-02-27 18:07:46 +01:00
..
main_test.go Add simple example 2025-02-27 16:08:02 +01:00
main.go Rename Variable* to Value* 2025-02-27 18:07:46 +01: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.