Better document numbering functions (#4648)

This commit is contained in:
Malo 2024-08-05 12:43:15 +02:00 committed by GitHub
parent ed247797ac
commit 6fbba6d73f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -33,6 +33,23 @@ use crate::text::Case;
/// 1, 2, 3,
/// )
/// ```
///
/// # Numbering patterns and numbering functions
/// There are multiple instances where you can provide a numbering pattern or
/// function in Typst. For example, when defining how to number
/// [headings]($heading) or [figures]($figure). Every time, the expected format
/// is the same as the one described below for the
/// [`numbering`]($numbering.numbering) parameter.
///
/// The following example illustrates that a numbering function is just a
/// regular [function] that accepts numbers and returns [`content`].
/// ```example
/// #let unary(.., last) = "|" * last
/// #set heading(numbering: unary)
/// = First heading
/// = Second heading
/// = Third heading
/// ```
#[func]
pub fn numbering(
/// The engine.