diff options
| -rw-r--r-- | crates/typst/src/model/label.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/crates/typst/src/model/label.rs b/crates/typst/src/model/label.rs index 0beb3bfc..117a682a 100644 --- a/crates/typst/src/model/label.rs +++ b/crates/typst/src/model/label.rs @@ -6,9 +6,12 @@ use crate::eval::{func, scope, ty, Repr}; /// A label for an element. /// -/// Inserting a label into content attaches it to the closest previous element -/// that is not a space. Then, the element can be [referenced]($ref) and styled -/// through the label. +/// Inserting a label into content attaches it to the closest preceding element +/// that is not a space. The preceding element must be in the same scope as the +/// label, which means that `[Hello #[<label>]]`, for instance, wouldn't work. +/// +/// A labelled element can be [referenced]($ref), [queried]($query) for, and +/// [styled]($styling) through its label. /// /// # Example /// ```example @@ -22,6 +25,9 @@ use crate::eval::{func, scope, ty, Repr}; /// # Syntax /// This function also has dedicated syntax: You can create a label by enclosing /// its name in angle brackets. This works both in markup and code. +/// +/// Currently, labels can only be attached to elements in markup mode, not in +/// code mode. This might change in the future. #[ty(scope)] #[derive(Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] pub struct Label(pub EcoString); |
