Make math shorthands noncontinuable (#5925)

This commit is contained in:
Max 2025-02-23 11:28:24 +00:00 committed by GitHub
parent 240f238eee
commit 55bc5f4c94
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 4 deletions

View File

@ -271,10 +271,11 @@ fn math_expr_prec(p: &mut Parser, min_prec: usize, stop: SyntaxKind) {
} }
SyntaxKind::Text | SyntaxKind::MathText | SyntaxKind::MathShorthand => { SyntaxKind::Text | SyntaxKind::MathText | SyntaxKind::MathShorthand => {
continuable = matches!( continuable = !p.at(SyntaxKind::MathShorthand)
math_class(p.current_text()), && matches!(
None | Some(MathClass::Alphabetic) math_class(p.current_text()),
); None | Some(MathClass::Alphabetic)
);
if !maybe_delimited(p) { if !maybe_delimited(p) {
p.eat(); p.eat();
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 475 B

View File

@ -13,6 +13,11 @@ $ underline(f' : NN -> RR) \
1 - 0 thick &..., 1 - 0 thick &...,
) $ ) $
--- math-shorthands-noncontinuable ---
// Test that shorthands are not continuable.
$ x >=(y) / z \
x >= (y) / z $
--- math-common-symbols --- --- math-common-symbols ---
// Test common symbols. // Test common symbols.
$ dot \ dots \ ast \ tilde \ star $ $ dot \ dots \ ast \ tilde \ star $