Skip to content

Render via templates#88

Closed
istathar wants to merge 26 commits intotechnique-lang:mainfrom
istathar:render-via-template
Closed

Render via templates#88
istathar wants to merge 26 commits intotechnique-lang:mainfrom
istathar:render-via-template

Conversation

@istathar
Copy link
Copy Markdown
Member

@istathar istathar commented Jan 10, 2026

Refactor the machinery orchestrating rendering at the top-level. Change the --output option of technique render to select between writing PDF and writing Typst markup (for debugging). Articulate a new Template trait and add a new --template option to the technique render command, with use source as the current default.

Templates are composed of two phases. First there is an "adapter" which takes the abstract syntax tree from the parser and projects it into a set of types suitable to the domain being modelled, and then there is a "renderer" which provides a custom implementation of transforming those domain objects into Typst markup.

Two templates are provided with _very+ preliminary implementations: a checklist one, meant for simple todo lists, and a procedure one, which presents an operations plan written in Technique with full fidelity.

Bumps the major version to 0.5.

@istathar istathar marked this pull request as ready for review March 7, 2026 10:51
@istathar istathar self-assigned this Mar 7, 2026
@istathar istathar closed this Mar 11, 2026
istathar added a commit that referenced this pull request Mar 11, 2026
Redesign the rendering pipeline so that presentation logic lives in
Typst template files rather than compiled Rust code, thus enabling
user-defined templates written in Typst.

This continues and supersedes #88. Adapters are refactored to emit a
Typst literal, and templates are reinterpreted to mean a Typst file
which supplies a render() function which, when given an appropriate
domain-specific literal, is renders out the appropriate layout.

Every domain has an Adapter which projects from the parser's internal
AST to a set of types that are domain-specific. These are denormalized
and suitable for being used by a template. These domain-specific objects
are then serialized out as a Typst literal.

This literal can then be used by a Template. Each domain has a default
built in, but the `--template` command-line option allows the user to
specify their own Typst file to handle the rendering.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant