mirror of
https://github.com/typst/typst
synced 2025-06-20 20:32:53 +08:00
Ensure that label repr is syntactically valid (#6456)
This commit is contained in:
parent
64d0a564bf
commit
f32cd5b3e1
@ -79,7 +79,12 @@ impl Label {
|
|||||||
|
|
||||||
impl Repr for Label {
|
impl Repr for Label {
|
||||||
fn repr(&self) -> EcoString {
|
fn repr(&self) -> EcoString {
|
||||||
eco_format!("<{}>", self.resolve())
|
let resolved = self.resolve();
|
||||||
|
if typst_syntax::is_valid_label_literal_id(&resolved) {
|
||||||
|
eco_format!("<{resolved}>")
|
||||||
|
} else {
|
||||||
|
eco_format!("label({})", resolved.repr())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user