Mention str(<label>) feature in documentation for label (#2906)

This commit is contained in:
Malo 2023-12-11 17:03:26 +01:00 committed by GitHub
parent d52fcd5b46
commit ce9d420472
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -12,6 +12,9 @@ use crate::util::PicoStr;
/// A labelled element can be [referenced]($ref), [queried]($query) for, and
/// [styled]($styling) through its label.
///
/// Once constructed, you can get the name of a label using
/// [`str`]($str/#constructor).
///
/// # Example
/// ```example
/// #show <a>: set text(blue)

View File

@ -63,3 +63,10 @@ _Visible_
#test([Hello<hi>].label, <hi>)
#test([#[A *B* C]<hi>].label, <hi>)
#test([#text(red)[Hello]<hi>].label, <hi>)
---
// Test getting the name of a label.
// Ref: false
#test(str(<hey>), "hey")
#test(str(label("hey")), "hey")
#test(str([Hmm<hey>].label), "hey")