Import All Functions Syntax

Is it possible to import all functions without specifically naming each function?

For example:

#import "template.typ": *

It would be similar syntax to rust modules.

Yes, this was a dumb question. It seems this is exactly how it is already done. I just couldn’t find it documented, but found in templates.

Yeah, the Scripting documentation say this:

  • Import items: import "bar.typ": a, b
    Evaluates the file at the path bar.typ, extracts the values of the variables a and b (that need to be defined in bar.typ, e.g. through let bindings) and defines them in the current file. Replacing a, b with * loads all variables defined in a module. …

But it’s just blink and you’ll miss it, this should probably be an item by itself rather than a short remark inside one of the item.

1 Like

Agreed, I even searched for it in the documentation with the search tab, and nada. Thank you for highlighting that.

Maybe if examples were shown for each instead of describing with a paragraph, it would have popped up. I personally hate wordy docs vs concise with good examples and visuals, but that is just me. I know others like different docs.

By the way, we can use AI/LLM services to search Typst docs with rough words. Their final responses might be wrong, but the original descriptions in Typst docs will be shown as well.

Examples: