diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-10-09 13:58:39 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-10-09 13:58:39 +0200 |
| commit | cb7079711a75df0126a8e02f0d6b0620495637ec (patch) | |
| tree | f3e9ca3b6b6c31146837ccf7463f4300520fa5cd | |
| parent | 6dab95473b04b3c72c552de0168adc76781cd9e8 (diff) | |
Expand label docs
Co-Authored-By: Andrew Voynov <37143421+Andrew15-5@users.noreply.github.com>
| -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); |
