Force @ refs to have an immediate label (#5776)

This commit is contained in:
Said Aroua 2025-05-25 17:52:44 +02:00
parent 43c3acdc4e
commit ef84635b09
2 changed files with 10 additions and 1 deletions

View File

@ -196,7 +196,7 @@ impl Lexer<'_> {
'h' if self.s.eat_if("ttp://") => self.link(),
'h' if self.s.eat_if("ttps://") => self.link(),
'<' if self.s.at(is_id_continue) => self.label(),
'@' => self.ref_marker(),
'@' if self.s.at(is_id_continue) => self.ref_marker(),
'.' if self.s.eat_if("..") => SyntaxKind::Shorthand,
'-' if self.s.eat_if("--") => SyntaxKind::Shorthand,

View File

@ -85,3 +85,12 @@ Text seen on #ref(<text>, form: "page", supplement: "Page").
// Test reference with non-whitespace before it.
#figure[] <1>
#test([(#ref(<1>))], [(@1)])
--- ref-to-empty-label-not-possible ---
// @ without any following label should just produce the symbol in the output
// and not produce a reference to a label with an empty name.
@ \<- this should show up
// using ref() should also not be possible
// Error: 6-7 unexpected less-than operator
// Error: 7-8 unexpected greater-than operator
#ref(<>)