Introduction
Prequery is a Typst package and command line tool for getting external information into Typst documents. It allows you to break Typst's sandbox in a controlled way, achieving things that in TeX would be done through "shell escape".
The Prequery package allows you to prepare your documents so that they provide information to tools outside the sandbox. See Using Prequery in documents on how to use it.
The prequery
prequery
CLI tool is one such tool that can process this information to prepare results for use inside your documents. See Installation and Running the preprocessor on how to use that.
A system like Prequery is fundamentally subject to some limitations and caveats. Using external tools means that you need to trust more than just the Typst application, and that documents using Prequery are no longer platform independent. The prequery
prequery
tool is available for Linux, Windows and Mac, but other tools may not be. Projects in the web app are not supported, as you can't run external tools there.
Prequery is still in early development; it works as an end-to-end solution to download files needed by your document from the web, and there is early support for running arbitrary shell commands. If you need other features, feel free to open an issue on the package or the CLI tool. You can also build your own features on top of what's already there and pull requests are welcome.
There are several other use cases that could be solved by a prequery-supported workflow:
-
Pre-rendering diagrams using tools such as PlantUML, Mermaid.js, or Pintora. (For the latter, there is also Pintorita, which runs inside Typst.)
-
Using Typst for literate programming/executable notebooks, like jlyfish allows for Julia.
-
… anything else where excellent native tools are available but are not accessible from Typst directly.
(If you have another tool that someone finding Prequery may be interested in, let us know so that we can add a link here!)