Add Typst support #1623
Labels
area: frontend
Related to output and formatting
category: utilities
Related to utilities
status: approved
The issue has received a core developer's approval
type: feature
Relating to the functionality of the application.
Description
Add a
.typst
command, working similarly to.latex
but for rendering Typst.Reasoning
The bot's
.latex
command has been notoriously unstable in the past, but nowadays is mostly working. However, it's pretty hard to consistently write correct LaTeX snippets on the first try, and the error logs are not especially helpful because LaTeX logs rarely are. It would be nice to have a simpler alternative for quickly writing some simple math, and Typst would fill that niche - Typst source code is much more readable and doesn't require an explicit preamble. The following is an (entire!) typst document:$lim_(h -> 0) (f(x + h) - f(x))/h$
which renders to:
Proposed Implementation
Typst has a Python library, so the implementation should be straightforward. Here's a proof of concept:
An interesting detail is the handling of third-party packages. The Latex cog is currently implemented as having a specific set of whitelisted packages available. Typst, meanwhile, by default supports importing arbitrary packages at runtime to be downloaded during the compilation process - which in theory is safe because typst plugins are required to be pure functions that get compiled to WASM. Nevertheless, probably at first it'd be best to only allow a shortlist of popular packages, but in the future we could consider removing that limit.
Would you like to implement this yourself?
The text was updated successfully, but these errors were encountered: