Update README.md & Update test.yml

This commit is contained in:
David Vogel 2024-12-19 00:16:08 +01:00
parent 88837c7ba0
commit f39b560bda
3 changed files with 20 additions and 5 deletions

View File

@ -10,13 +10,14 @@ jobs:
strategy:
matrix:
go-version: ['1.23.x']
typst-version: ['0.12.0']
steps:
- name: Install typst-cli from crates.io
- name: Install typst-cli ${{ matrix.typst-version }} from crates.io
uses: baptiste0928/cargo-install@v3
with:
crate: typst-cli
version: '0.12.0'
version: '${{ matrix.typst-version }}'
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v5

View File

@ -2,12 +2,24 @@
A library to generate documents and reports by utilizing the command line version of [typst].
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.
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:
- Typst 0.12.0
## Features
- Encoder to convert go objects into typst objects which then can be injected into typst documents.
- Parsing of stderr into an go error object.
- PDF, SVG or PNG generation.
- All typst-cli parameters are available as a struct, which makes it easy to discover all available options.
- Encoder to convert go values into typst markup which can be injected into typst documents.
- Any stderr will be returned as go error value, including line number, column and file path of the error.
- Uses stdio; No temporary files need to be created.
- Good test coverage of features.
- Good unit test coverage.
## Installation

2
cli.go
View File

@ -46,6 +46,8 @@ func (c CLI) VersionString() (string, error) {
return output.String(), nil
}
// TODO: Rename Render to Compile
// Render takes a typst document from input, and renders it into the output writer.
// The options parameter is optional.
func (c CLI) Render(input io.Reader, output io.Writer, options *CLIOptions) error {