typst

package
v1.0.28 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 25, 2025 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyDir

func CopyDir(src, dst string) error

CopyDir copies a directory recursively from src to dst

func CopyFile

func CopyFile(src, dst string) error

CopyFile copies a file from src to dst

Types

type CompileOpts

type CompileOpts struct {
	// Input file path
	InputFile string
	// Output file name (optional, if not provided a temp file will be created)
	OutputFile string
	// Font paths to include
	FontDirs []string
	// Additional command-line arguments
	ExtraArgs []string
}

CompileOpts contains options for compiling a Typst document

type CompileOptsBuilder

type CompileOptsBuilder func(c *CompileOpts)

func WithExtraArgs

func WithExtraArgs(extraArgs ...string) CompileOptsBuilder

func WithFontDirs

func WithFontDirs(fontDirs ...string) CompileOptsBuilder

func WithInputFile

func WithInputFile(inputFile string) CompileOptsBuilder

func WithOutputFile

func WithOutputFile(outputFile string) CompileOptsBuilder

type Compiler

type Compiler interface {
	Compile(opts CompileOpts) (string, error)
	CompileToBytes(opts CompileOpts) ([]byte, error)
	CompileTemplate(templateName string, data []byte, opts ...CompileOptsBuilder) ([]byte, error)
	CleanupGeneratedFiles(files ...string)
}

func DefaultCompiler

func DefaultCompiler(logger *logger.Logger) Compiler

DefaultCompiler creates a compiler with default settings

func NewCompiler

func NewCompiler(logger *logger.Logger, binaryPath, fontDir, templateDir, outputDir string) Compiler

NewCompiler creates a new Typst compiler

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL