Syntax-highlighting Typst code with Prism
A demo, which also explains some things, can be found here.
The src/ directory contains a Prism language definition for typst which you can import after importing Prism, e.g.,
<script src="prism.js"></script>
<script src="prism-typst.js"></script>as well as a CSS stylesheet that imitates the color scheme of the Typst web app.
For use with a program using node.js (e.g., with Docusaurus), a light theme as well as a dark theme are available with the file src/typst-theme.js.
In order to maintain and improve this language definition for Prism, I'm looking for help with
- writing tests (important since regex matching so many things is a little brittle) and
- treating/fixing more edge cases (and improvements in general).