mirror of
https://github.com/typst/typst
synced 2025-05-21 12:35:29 +08:00
Clarify syntactical difference in label
function docs (#4957)
This commit is contained in:
parent
58c71ade2f
commit
79558f44a0
@ -29,6 +29,16 @@ use crate::utils::PicoStr;
|
||||
/// its name in angle brackets. This works both in markup and code. A label's
|
||||
/// name can contain letters, numbers, `_`, `-`, `:`, and `.`.
|
||||
///
|
||||
/// Note that there is a syntactical difference when using the dedicated syntax
|
||||
/// for this function. In the code below, the `[<a>]` terminates the heading and
|
||||
/// thus attaches to the heading itself, whereas the `[#label("b")]` is part of
|
||||
/// the heading and thus attaches to the heading's text.
|
||||
///
|
||||
/// ```typ
|
||||
/// = Intro <a> // Equivalent to `#heading[Intro] <a>`.
|
||||
/// = Concl #label("b") // Equivalent to `#heading[Concl #label("b")]`.
|
||||
/// ```
|
||||
///
|
||||
/// Currently, labels can only be attached to elements in markup mode, not in
|
||||
/// code mode. This might change in the future.
|
||||
#[ty(scope, cast)]
|
||||
|
Loading…
x
Reference in New Issue
Block a user