Document how to import func (#3889)

Co-authored-by: Laurenz <laurmaedje@gmail.com>
This commit is contained in:
Rik Huijzer 2024-04-09 10:31:31 +02:00 committed by GitHub
parent 2663f42442
commit 7ea55ec9a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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