diff --git a/services/web/frontend/js/features/source-editor/lezer-typst/typst.grammar b/services/web/frontend/js/features/source-editor/lezer-typst/typst.grammar index 3ae665d4ed..4b0b52d027 100644 --- a/services/web/frontend/js/features/source-editor/lezer-typst/typst.grammar +++ b/services/web/frontend/js/features/source-editor/lezer-typst/typst.grammar @@ -31,7 +31,10 @@ item { // HeadingMark is produced by an external tokenizer that enforces the // start-of-line constraint and captures the "=+" prefix + trailing space. Heading { HeadingMark HeadingTitle } -HeadingTitle { headingTitleItem* } +// headingTitleItem+ (not *) so HeadingTitle is never empty: the generator +// would otherwise produce a shift/reduce conflict on "*" after HeadingMark, +// unable to tell if "*" starts a Strong inside the heading or at doc level. +HeadingTitle { headingTitleItem+ } headingTitleItem { Strong | Emphasis | CodeExpr | InlineMath | RawInline | Label | Ref | HeadingText }