summaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorRik Huijzer <github@huijzer.xyz>2024-04-09 10:31:31 +0200
committerGitHub <noreply@github.com>2024-04-09 08:31:31 +0000
commit7ea55ec9a09c6ca92eb272f99c03499d1cdd5ee3 (patch)
tree32abfef77dd6061663ed46cb22c26901a1a05982 /crates
parent2663f424425bcaddc66f1407064629c0843c4b74 (diff)
Document how to import func (#3889)
Co-authored-by: Laurenz <laurmaedje@gmail.com>
Diffstat (limited to 'crates')
-rw-r--r--crates/typst/src/foundations/func.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/crates/typst/src/foundations/func.rs b/crates/typst/src/foundations/func.rs
index 70fbea77..42f2c6ad 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