From 7ea55ec9a09c6ca92eb272f99c03499d1cdd5ee3 Mon Sep 17 00:00:00 2001 From: Rik Huijzer Date: Tue, 9 Apr 2024 10:31:31 +0200 Subject: [PATCH] Document how to import func (#3889) Co-authored-by: Laurenz --- crates/typst/src/foundations/func.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/typst/src/foundations/func.rs b/crates/typst/src/foundations/func.rs index 70fbea77d..42f2c6ad8 100644 --- a/crates/typst/src/foundations/func.rs +++ b/crates/typst/src/foundations/func.rs @@ -102,6 +102,12 @@ pub use typst_macros::func; /// ] /// ``` /// +/// # Importing functions +/// Functions can be imported from one file ([`module`]($scripting/#modules)) into +/// another using `{import}`. For example, assume that we have defined the `alert` +/// function from the previous example in a file called `foo.typ`. We can import +/// it into another file by writing `{import "foo.typ": alert}`. +/// /// # Unnamed functions { #unnamed } /// You can also created an unnamed function without creating a binding by /// specifying a parameter list followed by `=>` and the function body. If your