Expand label docs

Co-Authored-By: Andrew Voynov <37143421+Andrew15-5@users.noreply.github.com>
This commit is contained in:
Laurenz 2023-10-09 13:58:39 +02:00
parent 6dab95473b
commit cb7079711a

View File

@ -6,9 +6,12 @@ use crate::eval::{func, scope, ty, Repr};
/// A label for an element. /// A label for an element.
/// ///
/// Inserting a label into content attaches it to the closest previous element /// Inserting a label into content attaches it to the closest preceding element
/// that is not a space. Then, the element can be [referenced]($ref) and styled /// that is not a space. The preceding element must be in the same scope as the
/// through the label. /// 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
/// ```example /// ```example
@ -22,6 +25,9 @@ use crate::eval::{func, scope, ty, Repr};
/// # Syntax /// # Syntax
/// This function also has dedicated syntax: You can create a label by enclosing /// 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. /// 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)] #[ty(scope)]
#[derive(Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] #[derive(Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct Label(pub EcoString); pub struct Label(pub EcoString);