Update README.md

This commit is contained in:
David Vogel 2025-01-12 14:57:32 +01:00
parent 40b899ee67
commit fec22822ea
3 changed files with 123 additions and 117 deletions

View File

@ -1,63 +1,66 @@
# go-typst [![test](https://github.com/Dadido3/go-typst/actions/workflows/test.yml/badge.svg)](https://github.com/Dadido3/go-typst/actions/workflows/test.yml)
A library to generate documents and reports by utilizing the command line version of [typst].
`go-typst` is a Go library that leverages the command-line interface of [Typst] to provide functions for the creation of documents and reports in various formats (PDF, SVG, PNG).
Its goal is to provide Go developers with a seamless, "Go-like" interface to Typst's powerful document generation capabilities.
This is basically a binding to typst-cli which exposes functions needed to compile documents into different formats like PDF, SVG or PNG. The goal is to make using typst as simple and "go like" as possible.
## Stability and Compatibility
This module, along with typst itself, is a work in progress.
The API may change, and compatibility with different typst versions are also not set in stone.
There is no way to prevent this as long as typst has breaking changes.
To mitigate problems arising from this, most of the functionality is unit tested against different typst releases.
The supported and tested versions right now are:
`go-typst` is a work in progress, and the API may change as Typst evolves.
Supported Typst versions are tested by unit tests to ensure compatibility:
- Typst 0.12.0
- **Supported Version:** Typst 0.12.0
While breaking changes may occur, i aim to minimize disruptions.
Use at your own discretion for production systems.
## Features
- PDF, SVG and PNG generation.
- All typst-cli parameters are [available as a struct](cli-options.go), which makes it easy to discover all available options.
- Encoder to convert go values into typst markup which can be injected into typst documents. This includes image.Image by using the [Image wrapper](image.go).
- Any stderr will be returned as go error value, including line number, column and file path of the error.
- All Typst parameters are discoverable and documented in [cli-options.go](cli-options.go).
- Go-to-Typst Object Encoder: Seamlessly inject any Go values (Including `image.Image` with a [wrapper](image.go)) into Typst documents via the provided encoder.
- Errors from Typst CLI are returned as structured Go error objects with detailed information, such as line numbers and file paths.
- Uses stdio; No temporary files will be created.
- Good unit test coverage.
## Installation
1. Use `go get github.com/Dadido3/go-typst` inside of your project to add this module to your project.
2. Install typst by following [the instructions in the typst repository].
2. Install Typst by following [the instructions in the Typst repository].
## Runtime requirements
You need to have [typst] installed on any machine that you want to run your go project on.
You can install it by following [the instructions in the typst repository].
This module assumes that the Typst executable is accessible from your system's PATH.
Ensure that you have [Typst] installed on any machine that your project will be executed.
You can install it by following [the instructions in the Typst repository].
Alternatively you can pack the typst executable with your application. In this case you have to set up the CLI object similar to this:
Alternatively you can pack the Typst executable with your application.
In this case you have to provide the path to the executable when setting up the `typst.CLI` object:
```go
typstCLI := typst.CLI{
ExecutablePath: "./typst",
ExecutablePath: "./typst", // Relative path to executable.
}
```
> [!NOTE]
> Make sure to follow the typst license requirements when you pack and distribute the typst executable with your software.
> Make sure to follow the Typst license requirements when you pack and distribute the Typst executable with your software.
## Usage
Here we will create a simple PDF document by passing a reader with typst markup into `typstCLI.Compile` and then let it write the resulting PDF data into a file:
Here we will create a simple PDF document by passing a reader with Typst markup into `typstCLI.Compile` and then let it write the resulting PDF data into a file:
```go
func main() {
r := bytes.NewBufferString(`#set page(width: 100mm, height: auto, margin: 5mm)
= go-typst
A library to generate documents and reports by utilizing the command line version of typst.
A library to generate documents and reports by utilizing the command line version of Typst.
#footnote[https://typst.app/]
== Features
- Encoder to convert go objects into typst objects which then can be injected into typst documents.
- Parsing of returned errors into go error objects.
- Encoder to convert Go objects into Typst objects which then can be injected into Typst documents.
- Parsing of returned errors into Go error objects.
- Uses stdio; No temporary files need to be created.
- Test coverage of most features.`)
@ -79,5 +82,5 @@ The resulting document will look like this:
![readme-1.svg](documentation/images/readme-1.svg)
[the instructions in the typst repository]: https://github.com/typst/typst?tab=readme-ov-file#installation
[typst]: https://typst.app/
[the instructions in the Typst repository]: https://github.com/typst/typst?tab=readme-ov-file#installation
[Typst]: https://typst.app/

View File

@ -96,15 +96,15 @@
<use xlink:href="#g1FAF2D57864CADD94EF517DE49525580" x="110.715" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g1A544954AC55B7CE26CD07523A9368CD" x="119.427" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g192EE907E2DFF3A48D21296CECA349C9" x="124.971" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g2A02D0AA9D96E2F8D5ABE86DB55E703F" x="131.131" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g3E2EABF41C5EBD8FAEDE08F17ABF0712" x="134.607" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g53AA44D6FA8ECF53438112F5436DDC62" x="140.272" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g1F85D90475359FDC524A81BD582EE1D" x="145.981" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g2A02D0AA9D96E2F8D5ABE86DB55E703F" x="150.271" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#gE13AE1D20AEA54CC842A0D0846A229CD" x="153.74699999999999" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g4C1C88EA62AEA8E33AA456477BDBEDFF" x="131.131" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g3E2EABF41C5EBD8FAEDE08F17ABF0712" x="137.159" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g53AA44D6FA8ECF53438112F5436DDC62" x="142.82399999999998" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g1F85D90475359FDC524A81BD582EE1D" x="148.533" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g2A02D0AA9D96E2F8D5ABE86DB55E703F" x="152.82299999999998" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#gE13AE1D20AEA54CC842A0D0846A229CD" x="156.29899999999998" fill="#000000" fill-rule="nonzero"/>
</g>
</g>
<g transform="translate(170.34022834645674 53.98222834645669)">
<g transform="translate(172.89222834645673 53.98222834645669)">
<g class="typst-text" transform="scale(1, -1)">
<use xlink:href="#g804C2AF772A3D00525371C3AD483C945" x="0" fill="#000000" fill-rule="nonzero"/>
</g>
@ -153,76 +153,76 @@
<use xlink:href="#g3ACDBD360E9A7E655037E81B9FC022A1" x="73.106" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g4041D22F057D2D815B51CCA6695474E7" x="78.023" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g2A02D0AA9D96E2F8D5ABE86DB55E703F" x="82.115" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#gC6020E626273A5328AECF9D6B6761D8F" x="88.341" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g1A544954AC55B7CE26CD07523A9368CD" x="93.841" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g1A544954AC55B7CE26CD07523A9368CD" x="102.13499999999999" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g245C07D17574AF153C7538607D350C99" x="107.67899999999999" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g598CA5EF303D57699A944FA5F0EBBE9D" x="113.10199999999999" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g3ACDBD360E9A7E655037E81B9FC022A1" x="116.094" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g9BF57F57784711F606B74D6094FB4DC" x="121.088" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g2A02D0AA9D96E2F8D5ABE86DB55E703F" x="125.79599999999999" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g1F85D90475359FDC524A81BD582EE1D" x="129.272" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#gC4884679AF2BF1CF58B03FB93A990B41" x="136.31199999999998" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g1FAF2D57864CADD94EF517DE49525580" x="139.29299999999998" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g2A02D0AA9D96E2F8D5ABE86DB55E703F" x="145.25499999999997" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g1A544954AC55B7CE26CD07523A9368CD" x="148.73099999999997" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g2A02D0AA9D96E2F8D5ABE86DB55E703F" x="157.02499999999998" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g3E2EABF41C5EBD8FAEDE08F17ABF0712" x="160.50099999999998" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g53AA44D6FA8ECF53438112F5436DDC62" x="166.16599999999997" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g1F85D90475359FDC524A81BD582EE1D" x="171.87499999999997" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g2A02D0AA9D96E2F8D5ABE86DB55E703F" x="176.16499999999996" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g1A544954AC55B7CE26CD07523A9368CD" x="182.39099999999996" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g245C07D17574AF153C7538607D350C99" x="187.93499999999997" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g598CA5EF303D57699A944FA5F0EBBE9D" x="193.35799999999998" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g3ACDBD360E9A7E655037E81B9FC022A1" x="196.34999999999997" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g9BF57F57784711F606B74D6094FB4DC" x="201.34399999999997" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g2A02D0AA9D96E2F8D5ABE86DB55E703F" x="206.05199999999996" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g1F85D90475359FDC524A81BD582EE1D" x="209.52799999999996" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#gCBFCD6073DBD1AAFA7E29830327C1568" x="216.56799999999996" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g109192FEB219AAEA1769781B76FD6E13" x="224.78499999999997" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#gC4884679AF2BF1CF58B03FB93A990B41" x="230.70299999999997" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g9BF57F57784711F606B74D6094FB4DC" x="233.68399999999997" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g109192FEB219AAEA1769781B76FD6E13" x="238.39199999999997" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g561931DD1CB605C040732B2D975F6F85" x="88.341" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g1A544954AC55B7CE26CD07523A9368CD" x="95.87599999999999" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g1A544954AC55B7CE26CD07523A9368CD" x="104.16999999999999" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g245C07D17574AF153C7538607D350C99" x="109.71399999999998" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g598CA5EF303D57699A944FA5F0EBBE9D" x="115.13699999999999" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g3ACDBD360E9A7E655037E81B9FC022A1" x="118.12899999999999" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g9BF57F57784711F606B74D6094FB4DC" x="123.12299999999999" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g2A02D0AA9D96E2F8D5ABE86DB55E703F" x="127.83099999999999" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g1F85D90475359FDC524A81BD582EE1D" x="131.307" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#gC4884679AF2BF1CF58B03FB93A990B41" x="138.34699999999998" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g1FAF2D57864CADD94EF517DE49525580" x="141.32799999999997" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g2A02D0AA9D96E2F8D5ABE86DB55E703F" x="147.28999999999996" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g1A544954AC55B7CE26CD07523A9368CD" x="150.76599999999996" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g4C1C88EA62AEA8E33AA456477BDBEDFF" x="159.05999999999997" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g3E2EABF41C5EBD8FAEDE08F17ABF0712" x="165.08799999999997" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g53AA44D6FA8ECF53438112F5436DDC62" x="170.75299999999996" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g1F85D90475359FDC524A81BD582EE1D" x="176.46199999999996" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g2A02D0AA9D96E2F8D5ABE86DB55E703F" x="180.75199999999995" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g1A544954AC55B7CE26CD07523A9368CD" x="186.97799999999995" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g245C07D17574AF153C7538607D350C99" x="192.52199999999996" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g598CA5EF303D57699A944FA5F0EBBE9D" x="197.94499999999996" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g3ACDBD360E9A7E655037E81B9FC022A1" x="200.93699999999995" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g9BF57F57784711F606B74D6094FB4DC" x="205.93099999999995" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g2A02D0AA9D96E2F8D5ABE86DB55E703F" x="210.63899999999995" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g1F85D90475359FDC524A81BD582EE1D" x="214.11499999999995" fill="#000000" fill-rule="nonzero"/>
</g>
</g>
<g transform="translate(9.361 21.626)">
<g class="typst-text" transform="scale(1, -1)">
<use xlink:href="#g2A02D0AA9D96E2F8D5ABE86DB55E703F" x="0" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g109192FEB219AAEA1769781B76FD6E13" x="3.476" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g3ACDBD360E9A7E655037E81B9FC022A1" x="9.394" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g1FAF2D57864CADD94EF517DE49525580" x="14.311" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g9BF57F57784711F606B74D6094FB4DC" x="23.023" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#gA09CD41449CEB419B89512B50197494F" x="27.730999999999998" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g1FAF2D57864CADD94EF517DE49525580" x="32.757999999999996" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g245C07D17574AF153C7538607D350C99" x="41.47" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g3ACDBD360E9A7E655037E81B9FC022A1" x="47.003" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#gC4884679AF2BF1CF58B03FB93A990B41" x="54.67" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g1FAF2D57864CADD94EF517DE49525580" x="57.651" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g598CA5EF303D57699A944FA5F0EBBE9D" x="63.61300000000001" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g3ACDBD360E9A7E655037E81B9FC022A1" x="66.605" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g9BF57F57784711F606B74D6094FB4DC" x="71.599" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g2A02D0AA9D96E2F8D5ABE86DB55E703F" x="76.307" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g3ACDBD360E9A7E655037E81B9FC022A1" x="79.783" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g472A94AE5329BB7A0567477643A8B6FE" x="84.777" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#gC4884679AF2BF1CF58B03FB93A990B41" x="93.093" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g1FAF2D57864CADD94EF517DE49525580" x="96.074" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g2A02D0AA9D96E2F8D5ABE86DB55E703F" x="102.036" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g1A544954AC55B7CE26CD07523A9368CD" x="105.512" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g2A02D0AA9D96E2F8D5ABE86DB55E703F" x="113.806" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g3E2EABF41C5EBD8FAEDE08F17ABF0712" x="117.282" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g53AA44D6FA8ECF53438112F5436DDC62" x="122.947" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g1F85D90475359FDC524A81BD582EE1D" x="128.656" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g2A02D0AA9D96E2F8D5ABE86DB55E703F" x="132.946" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g472A94AE5329BB7A0567477643A8B6FE" x="139.172" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g1A544954AC55B7CE26CD07523A9368CD" x="144.738" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g9BF57F57784711F606B74D6094FB4DC" x="150.359" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#gFDDFAB12FE599B8F8477737612B6670C" x="155.067" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g3CD98724DCE900EDDFF2FA4ED896CFC9" x="160.90800000000002" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g3ACDBD360E9A7E655037E81B9FC022A1" x="169.598" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g1FAF2D57864CADD94EF517DE49525580" x="174.51500000000001" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g2A02D0AA9D96E2F8D5ABE86DB55E703F" x="180.477" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g1F85D90475359FDC524A81BD582EE1D" x="183.953" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#gE13AE1D20AEA54CC842A0D0846A229CD" x="188.243" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#gCBFCD6073DBD1AAFA7E29830327C1568" x="0" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g109192FEB219AAEA1769781B76FD6E13" x="8.217" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#gC4884679AF2BF1CF58B03FB93A990B41" x="14.135000000000002" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g9BF57F57784711F606B74D6094FB4DC" x="17.116000000000003" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g109192FEB219AAEA1769781B76FD6E13" x="21.824" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g2A02D0AA9D96E2F8D5ABE86DB55E703F" x="30.492" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g109192FEB219AAEA1769781B76FD6E13" x="33.968" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g3ACDBD360E9A7E655037E81B9FC022A1" x="39.886" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g1FAF2D57864CADD94EF517DE49525580" x="44.803000000000004" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g9BF57F57784711F606B74D6094FB4DC" x="53.51500000000001" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#gA09CD41449CEB419B89512B50197494F" x="58.223000000000006" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g1FAF2D57864CADD94EF517DE49525580" x="63.25000000000001" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g245C07D17574AF153C7538607D350C99" x="71.962" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g3ACDBD360E9A7E655037E81B9FC022A1" x="77.495" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#gC4884679AF2BF1CF58B03FB93A990B41" x="85.162" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g1FAF2D57864CADD94EF517DE49525580" x="88.143" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g598CA5EF303D57699A944FA5F0EBBE9D" x="94.105" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g3ACDBD360E9A7E655037E81B9FC022A1" x="97.09700000000001" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g9BF57F57784711F606B74D6094FB4DC" x="102.09100000000001" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g2A02D0AA9D96E2F8D5ABE86DB55E703F" x="106.799" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g3ACDBD360E9A7E655037E81B9FC022A1" x="110.275" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g472A94AE5329BB7A0567477643A8B6FE" x="115.269" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#gC4884679AF2BF1CF58B03FB93A990B41" x="123.58500000000001" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g1FAF2D57864CADD94EF517DE49525580" x="126.566" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g2A02D0AA9D96E2F8D5ABE86DB55E703F" x="132.528" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g1A544954AC55B7CE26CD07523A9368CD" x="136.004" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g4C1C88EA62AEA8E33AA456477BDBEDFF" x="144.298" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g3E2EABF41C5EBD8FAEDE08F17ABF0712" x="150.326" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g53AA44D6FA8ECF53438112F5436DDC62" x="155.99099999999999" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g1F85D90475359FDC524A81BD582EE1D" x="161.7" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g2A02D0AA9D96E2F8D5ABE86DB55E703F" x="165.98999999999998" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g472A94AE5329BB7A0567477643A8B6FE" x="172.21599999999998" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g1A544954AC55B7CE26CD07523A9368CD" x="177.78199999999998" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g9BF57F57784711F606B74D6094FB4DC" x="183.403" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#gFDDFAB12FE599B8F8477737612B6670C" x="188.111" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g3CD98724DCE900EDDFF2FA4ED896CFC9" x="193.952" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g3ACDBD360E9A7E655037E81B9FC022A1" x="202.642" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g1FAF2D57864CADD94EF517DE49525580" x="207.559" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g2A02D0AA9D96E2F8D5ABE86DB55E703F" x="213.521" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g1F85D90475359FDC524A81BD582EE1D" x="216.99699999999999" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#gE13AE1D20AEA54CC842A0D0846A229CD" x="221.28699999999998" fill="#000000" fill-rule="nonzero"/>
</g>
</g>
<g transform="translate(0 36.014)">
@ -259,21 +259,21 @@
<use xlink:href="#g1FAF2D57864CADD94EF517DE49525580" x="122.529" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g2A02D0AA9D96E2F8D5ABE86DB55E703F" x="128.49099999999999" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g1A544954AC55B7CE26CD07523A9368CD" x="131.96699999999998" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#gC6020E626273A5328AECF9D6B6761D8F" x="140.261" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g1A544954AC55B7CE26CD07523A9368CD" x="145.761" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g3ACDBD360E9A7E655037E81B9FC022A1" x="154.055" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g4041D22F057D2D815B51CCA6695474E7" x="158.972" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g4041D22F057D2D815B51CCA6695474E7" x="163.06400000000002" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g1A544954AC55B7CE26CD07523A9368CD" x="167.068" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g4041D22F057D2D815B51CCA6695474E7" x="172.61200000000002" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g1A544954AC55B7CE26CD07523A9368CD" x="179.45400000000004" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g245C07D17574AF153C7538607D350C99" x="184.99800000000005" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g598CA5EF303D57699A944FA5F0EBBE9D" x="190.42100000000005" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g3ACDBD360E9A7E655037E81B9FC022A1" x="193.41300000000004" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g9BF57F57784711F606B74D6094FB4DC" x="198.40700000000004" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g2A02D0AA9D96E2F8D5ABE86DB55E703F" x="203.11500000000004" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g1F85D90475359FDC524A81BD582EE1D" x="206.59100000000004" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#gE13AE1D20AEA54CC842A0D0846A229CD" x="210.88100000000003" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g561931DD1CB605C040732B2D975F6F85" x="140.261" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g1A544954AC55B7CE26CD07523A9368CD" x="147.796" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g3ACDBD360E9A7E655037E81B9FC022A1" x="156.09" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g4041D22F057D2D815B51CCA6695474E7" x="161.007" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g4041D22F057D2D815B51CCA6695474E7" x="165.09900000000002" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g1A544954AC55B7CE26CD07523A9368CD" x="169.103" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g4041D22F057D2D815B51CCA6695474E7" x="174.64700000000002" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g1A544954AC55B7CE26CD07523A9368CD" x="181.48900000000003" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g245C07D17574AF153C7538607D350C99" x="187.03300000000004" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g598CA5EF303D57699A944FA5F0EBBE9D" x="192.45600000000005" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g3ACDBD360E9A7E655037E81B9FC022A1" x="195.44800000000004" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g9BF57F57784711F606B74D6094FB4DC" x="200.44200000000004" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g2A02D0AA9D96E2F8D5ABE86DB55E703F" x="205.15000000000003" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#g1F85D90475359FDC524A81BD582EE1D" x="208.62600000000003" fill="#000000" fill-rule="nonzero"/>
<use xlink:href="#gE13AE1D20AEA54CC842A0D0846A229CD" x="212.91600000000003" fill="#000000" fill-rule="nonzero"/>
</g>
</g>
<g transform="translate(0 50.402)">
@ -490,6 +490,9 @@
<symbol id="g192EE907E2DFF3A48D21296CECA349C9" overflow="visible">
<path d="M 1.925 1.342 L 1.925 4.29 L 2.948 4.29 C 3.047 4.29 3.201 4.334 3.201 4.433 L 3.201 4.653 C 3.201 4.697 3.168 4.719 3.113 4.719 L 1.925 4.719 L 1.925 5.346 C 1.925 7.04 2.431 7.304 2.794 7.304 C 3.124 7.304 3.3 7.172 3.454 6.787 C 3.542 6.5889997 3.6629999 6.435 3.894 6.435 C 4.081 6.435 4.345 6.666 4.345 6.886 C 4.345 7.073 4.224 7.271 3.993 7.447 C 3.707 7.645 3.421 7.678 3.003 7.678 C 2.079 7.678 1.056 6.875 1.056 5.159 L 1.056 4.719 L 0.495 4.719 C 0.297 4.719 0.242 4.587 0.242 4.499 L 0.242 4.356 C 0.242 4.301 0.253 4.29 0.297 4.29 L 1.056 4.29 L 1.056 1.342 C 1.056 0.429 0.88 0.385 0.286 0.341 C 0.22 0.275 0.22 0.044 0.286 -0.022 C 0.671 -0.011 1.056 0 1.496 0 C 1.936 0 2.464 -0.011 2.849 -0.022 C 2.915 0.044 2.915 0.275 2.849 0.341 C 1.9909999 0.385 1.925 0.429 1.925 1.342 Z "/>
</symbol>
<symbol id="g4C1C88EA62AEA8E33AA456477BDBEDFF" overflow="visible">
<path d="M 3.85 1.342 L 3.85 5.544 C 3.85 6.248 3.96 6.666 4.356 6.666 L 4.598 6.666 C 5.423 6.666 5.94 6.38 6.127 5.533 C 6.248 5.533 6.402 5.544 6.501 5.588 C 6.424 6.094 6.369 6.6549997 6.358 7.15 C 6.358 7.161 6.336 7.183 6.325 7.183 C 5.9509997 7.15 4.73 7.095 3.861 7.095 L 2.915 7.095 C 2.068 7.095 0.77 7.15 0.352 7.183 C 0.32999998 7.183 0.308 7.161 0.308 7.15 C 0.264 6.6549997 0.154 6.083 0.033 5.555 C 0.143 5.511 0.275 5.5 0.407 5.5 C 0.627 6.38 1.133 6.666 1.859 6.666 L 2.398 6.666 C 2.805 6.666 2.915 6.248 2.915 5.577 L 2.915 1.342 C 2.915 0.429 2.728 0.374 1.848 0.341 C 1.782 0.275 1.782 0.044 1.848 -0.022 C 2.387 -0.011 2.948 0 3.388 0 C 3.806 0 4.367 -0.011 4.917 -0.022 C 4.983 0.044 4.983 0.275 4.917 0.341 C 4.037 0.374 3.85 0.429 3.85 1.342 Z "/>
</symbol>
<symbol id="gE13AE1D20AEA54CC842A0D0846A229CD" overflow="visible">
<path d="M 0.627 0.473 C 0.627 0.154 0.891 -0.11 1.21 -0.11 C 1.529 -0.11 1.793 0.154 1.793 0.473 C 1.793 0.792 1.529 1.056 1.21 1.056 C 0.891 1.056 0.627 0.792 0.627 0.473 Z "/>
</symbol>
@ -523,6 +526,9 @@
<symbol id="g812F4C78F3CDD80F7E06BCB7EF9BF27B" overflow="visible">
<path d="M 3.091 3.971 L 2.09 3.971 L 2.09 5.9509997 C 2.09 6.435 2.222 6.6549997 2.816 6.6549997 L 3.641 6.6549997 C 4.466 6.6549997 4.642 6.215 4.884 5.456 C 5.016 5.434 5.137 5.456 5.2469997 5.511 C 5.192 5.962 5.027 7.018 5.005 7.106 C 5.005 7.128 4.994 7.139 4.961 7.139 C 4.774 7.106 4.686 7.095 4.422 7.095 L 1.617 7.095 C 1.287 7.095 0.638 7.106 0.198 7.117 C 0.132 7.051 0.132 6.82 0.198 6.754 C 0.968 6.721 1.155 6.666 1.155 5.753 L 1.155 1.342 C 1.155 0.429 0.968 0.374 0.198 0.341 C 0.132 0.275 0.132 0.044 0.198 -0.022 C 0.605 -0.011 1.265 0 1.628 0 L 3.993 0 C 4.521 0 5.401 -0.022 5.401 -0.022 C 5.555 0.528 5.72 1.254 5.808 1.8149999 C 5.698 1.881 5.566 1.903 5.423 1.87 C 5.203 1.078 4.818 0.429 3.9819999 0.429 L 2.706 0.429 C 2.244 0.429 2.09 0.605 2.09 1.122 L 2.09 3.553 L 3.091 3.553 C 4.026 3.553 4.059 3.3 4.092 2.805 C 4.158 2.739 4.389 2.739 4.455 2.805 C 4.444 3.091 4.433 3.399 4.433 3.773 C 4.433 4.081 4.444 4.455 4.455 4.719 C 4.389 4.785 4.158 4.785 4.092 4.719 C 4.059 4.114 4.026 3.971 3.091 3.971 Z "/>
</symbol>
<symbol id="g561931DD1CB605C040732B2D975F6F85" overflow="visible">
<path d="M 4.147 7.238 C 2.31 7.238 0.407 5.797 0.407 3.377 C 0.407 1.397 1.771 -0.11 3.872 -0.11 C 5.17 -0.11 6.193 0.16499999 6.941 0.803 C 6.82 0.902 6.765 0.99 6.765 1.111 L 6.765 2.387 C 6.765 2.772 6.952 2.882 7.271 2.915 C 7.337 2.981 7.337 3.245 7.271 3.3109999 C 7.007 3.3 6.732 3.289 6.292 3.289 C 5.929 3.289 5.412 3.3 4.928 3.3109999 C 4.862 3.245 4.862 2.981 4.928 2.915 C 5.533 2.871 5.83 2.827 5.83 2.387 L 5.83 0.704 C 5.456 0.352 4.719 0.286 4.125 0.286 C 2.387 0.286 1.4629999 2.145 1.4629999 3.597 C 1.4629999 5.522 2.717 6.842 3.993 6.842 C 5.588 6.842 6.039 5.929 6.325 4.983 C 6.446 4.972 6.567 4.994 6.6879997 5.049 C 6.666 5.511 6.611 5.9509997 6.435 6.743 C 5.775 6.853 5.368 7.238 4.147 7.238 Z "/>
</symbol>
<symbol id="g598CA5EF303D57699A944FA5F0EBBE9D" overflow="visible">
<path d="M 1.243 3.487 L 1.243 0.83599997 C 1.243 -0.616 1.199 -1.969 0.649 -1.969 C 0.528 -1.969 0.385 -1.925 0.308 -1.848 C 0.198 -1.738 0.066 -1.562 -0.176 -1.562 C -0.297 -1.562 -0.528 -1.782 -0.528 -1.98 C -0.528 -2.299 -0.132 -2.453 0.077 -2.453 C 0.308 -2.453 0.88 -2.42 1.287 -2.079 C 1.804 -1.661 2.112 -0.869 2.112 1.21 L 2.112 3.531 C 2.112 4.081 2.156 4.785 2.156 4.785 C 2.156 4.829 2.101 4.862 2.013 4.862 C 1.705 4.741 1.265 4.642 0.506 4.5429997 C 0.484 4.4769998 0.506 4.301 0.528 4.235 C 1.122 4.18 1.243 4.114 1.243 3.487 Z M 1.089 6.5889997 C 1.089 6.303 1.353 6.017 1.617 6.017 C 1.925 6.017 2.189 6.314 2.189 6.545 C 2.189 6.809 1.958 7.117 1.661 7.117 C 1.397 7.117 1.089 6.853 1.089 6.5889997 Z "/>
</symbol>
@ -544,9 +550,6 @@
<symbol id="gE0AC4DF5F4B7ACBC698F7866E0D9E177" overflow="visible">
<path d="M 5.17 1.342 L 5.17 3.6629999 C 5.17 4.092 5.2139997 4.796 5.2139997 4.796 C 5.2139997 4.84 5.148 4.862 5.104 4.862 C 4.774 4.73 4.455 4.719 4.07 4.719 L 1.903 4.719 L 1.903 5.346 C 1.903 6.391 2.277 7.304 3.025 7.304 C 3.498 7.304 3.872 7.183 3.96 6.732 C 4.07 6.182 4.301 6.017 4.642 6.017 C 4.884 6.017 5.115 6.237 5.115 6.468 C 5.115 7.15 4.18 7.678 3.157 7.678 C 2.651 7.678 2.046 7.48 1.595 6.952 C 1.133 6.413 1.034 5.742 1.034 4.884 L 1.034 4.719 L 0.495 4.719 C 0.297 4.719 0.242 4.587 0.242 4.499 L 0.242 4.356 C 0.242 4.301 0.253 4.29 0.297 4.29 L 1.034 4.29 L 1.034 1.342 C 1.034 0.429 0.913 0.385 0.319 0.341 C 0.253 0.275 0.253 0.044 0.319 -0.022 C 0.693 -0.011 1.089 0 1.474 0 C 1.859 0 2.354 -0.011 2.717 -0.022 C 2.783 0.044 2.783 0.275 2.717 0.341 C 2.013 0.385 1.903 0.429 1.903 1.342 L 1.903 4.29 L 3.872 4.29 C 4.213 4.29 4.301 4.07 4.301 3.509 L 4.301 1.342 C 4.301 0.429 4.169 0.385 3.564 0.341 C 3.498 0.275 3.498 0.044 3.564 -0.022 C 3.949 -0.011 4.345 0 4.741 0 C 5.126 0 5.555 -0.011 5.962 -0.022 C 6.028 0.044 6.028 0.275 5.962 0.341 C 5.291 0.385 5.17 0.429 5.17 1.342 Z "/>
</symbol>
<symbol id="g4C1C88EA62AEA8E33AA456477BDBEDFF" overflow="visible">
<path d="M 3.85 1.342 L 3.85 5.544 C 3.85 6.248 3.96 6.666 4.356 6.666 L 4.598 6.666 C 5.423 6.666 5.94 6.38 6.127 5.533 C 6.248 5.533 6.402 5.544 6.501 5.588 C 6.424 6.094 6.369 6.6549997 6.358 7.15 C 6.358 7.161 6.336 7.183 6.325 7.183 C 5.9509997 7.15 4.73 7.095 3.861 7.095 L 2.915 7.095 C 2.068 7.095 0.77 7.15 0.352 7.183 C 0.32999998 7.183 0.308 7.161 0.308 7.15 C 0.264 6.6549997 0.154 6.083 0.033 5.555 C 0.143 5.511 0.275 5.5 0.407 5.5 C 0.627 6.38 1.133 6.666 1.859 6.666 L 2.398 6.666 C 2.805 6.666 2.915 6.248 2.915 5.577 L 2.915 1.342 C 2.915 0.429 2.728 0.374 1.848 0.341 C 1.782 0.275 1.782 0.044 1.848 -0.022 C 2.387 -0.011 2.948 0 3.388 0 C 3.806 0 4.367 -0.011 4.917 -0.022 C 4.983 0.044 4.983 0.275 4.917 0.341 C 4.037 0.374 3.85 0.429 3.85 1.342 Z "/>
</symbol>
<symbol id="g6A7F2FC01214F1089DD066F2ABAD470C" overflow="visible">
<path d="M 1.26225 5.797 C 1.37445 5.797 1.39315 5.71285 1.39315 5.41365 L 1.39315 4.19815 C 1.39315 3.7213 1.1033 3.69325 0.7293 3.67455 C 0.68255 3.59975 0.6919 3.4595 0.7293 3.4034 C 1.0098 3.41275 1.29965 3.41275 1.6269 3.41275 C 1.93545 3.41275 2.1318 3.41275 2.4122999 3.4034 C 2.4496999 3.46885 2.4496999 3.59975 2.4122999 3.67455 C 2.0944 3.69325 1.89805 3.7213 1.89805 4.19815 L 1.89805 6.4328 C 1.8513 6.47955 1.7765 6.46085 1.72975 6.4328 C 1.31835 6.18035 1.07525 6.06815 0.6358 5.9092 C 0.6358 5.797 0.6545 5.71285 0.7293 5.65675 C 0.96305 5.7409 1.1407 5.797 1.26225 5.797 Z "/>
</symbol>

Before

Width:  |  Height:  |  Size: 96 KiB

After

Width:  |  Height:  |  Size: 97 KiB

View File

@ -12,13 +12,13 @@ func TestREADME1(t *testing.T) {
r := bytes.NewBufferString(`#set page(width: 100mm, height: auto, margin: 5mm)
= go-typst
A library to generate documents and reports by utilizing the command line version of typst.
A library to generate documents and reports by utilizing the command line version of Typst.
#footnote[https://typst.app/]
== Features
- Encoder to convert go objects into typst objects which then can be injected into typst documents.
- Parsing of returned errors into go error objects.
- Encoder to convert Go objects into Typst objects which then can be injected into Typst documents.
- Parsing of returned errors into Go error objects.
- Uses stdio; No temporary files need to be created.
- Test coverage of most features.`)