Just so you know, Typst supports reading xml directly: XML Function – Typst Documentation
You may be interested in these other threads:
- Is there a way to programmaticaly generate documents? – discusses how templating with external software could be replaced with Typst scripting
- Can I configure my document (e.g. draft/release version, color theme) when creating a PDF without modifying the Typst file directly? - #3 by SillyFreak – discusses loading data into Typst in general, particularly avoiding having to put data into the Typst source code directly by instead loading it from a file (the example in that post uses JSON, but you could use XML)
Also to reiterate: if you use raw blocks (```...```
), you don’t need to escape Typst control commands. Raw blocks can also use more that three backticks (e.g. (``````...``````
) if you can’t guarantee that your inputs won’t contain ```
. But you get around all needs for escaping by loading the data from file instead of putting it in your Typst source code.