mirror of
https://github.com/Dadido3/go-typst.git
synced 2025-04-11 12:13:16 +00:00
- 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 |
||
---|---|---|
.. | ||
main_test.go | ||
main.go | ||
output.pdf | ||
README.md |
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.