This repository contains example Oicana templates. These templates can be packed with the Oicana CLI and used to create documents through integrations.
See the documentation for more info: https://docs.oicana.com
You should set up an IDE with support for Typst for intelli sense and live previews. There are a couple options, but for the sake of simplicity the following documents the setup for VS Code:
- Get/install VS Code https://code.visualstudio.com/download
- Install the
Tinymist TypstandEven Better TOMLplugins - Open the entrypoint file of the template you would like a preview for
- Open the Command Palette (Ctrl + Shift + P)
- Search and select the command "Typst Preview: preview current file"
- alternatively use the preview key binding
Ctrl + K V
You can repeat 3. for multiple templates. Any change in a template will trigger a rerender of the preview.
The preview is interactive. For most parts of the output you can click to jump to the relevant position in the code.
You can use typstyle to format Typst files. After installing according to the projects Readme, run typstyle -i . to format all .typ files in the repository.
The minimal Oicana template has no dynamic inputs and consists of two files: typst.toml and main.typ
The minimal manifest typst.toml looks like
[package]
name = "minimal"
version = "0.1.0"
entrypoint = "main.typ"
[tool.oicana]
manifest_version = 1And the main.typ file contains "normal" Typst content:
= Hello from Typst
This template will always render to the same text.
To use the full potential of Oicana, #link("https://docs.oicana.com/templates/inputs")[introduce some dynamic inputs].To use a template with an integration (the C# package for example), it has to be packed. Here are some example commands to pack templates:
oicana pack --allto pack all templates in the current directory (including child directories)oicana pack templates/invoice -o packedto pack the template in thetemplates/invoicedirectory and put the tar ball into thepackeddirectory
For testing purposes, you can also compile (not packed) templates with the Oicana CLI. Compilation output is placed in the output directory.
Blob and json inputs can be given as file paths:
oicana compile templates/invoice -f png -j invoice=templates/invoice/invoice.json -b banner=templates/invoice/oicana.pngoicana compile templates/table -j data=templates/table/tests/largerTable.jsonoicana compile templates/dependency -j data=templates/dependency/sample.json
Templates can define snapshot tests. You can run all of the tests for all templates in a directory with oicana test -a.