From 0b639c75109a93852040206ac247fa48c18bdb44 Mon Sep 17 00:00:00 2001 From: "Y.D.X." <73375426+YDX-2147483647@users.noreply.github.com> Date: Thu, 7 Aug 2025 23:02:43 +0800 Subject: [PATCH] Document escaping semicolon, valid identifiers, and `state` tips (#6674) Co-authored-by: Andrew Voynov <37143421+Andrew15-5@users.noreply.github.com> Co-authored-by: Yaksher Co-authored-by: Laurenz --- crates/typst-library/src/foundations/label.rs | 5 +- .../src/introspection/counter.rs | 2 +- .../typst-library/src/introspection/state.rs | 62 +++++++++++++++++-- docs/reference/language/scripting.md | 7 ++- docs/reference/language/syntax.md | 28 +++++++++ 5 files changed, 95 insertions(+), 9 deletions(-) diff --git a/crates/typst-library/src/foundations/label.rs b/crates/typst-library/src/foundations/label.rs index 5a9e76538..e326a4fa9 100644 --- a/crates/typst-library/src/foundations/label.rs +++ b/crates/typst-library/src/foundations/label.rs @@ -75,7 +75,10 @@ impl Label { /// Creates a label from a string. #[func(constructor)] pub fn construct( - /// The name of the label. Must not be empty. + /// The name of the label. + /// + /// Unlike the [dedicated syntax](#syntax), this constructor accepts + /// any non-empty string, including names with special characters. name: Str, ) -> StrResult