fix: better grammar on incomplete heading (#187)

This commit is contained in:
Myriad-Dreamin 2024-04-12 09:49:36 +08:00 committed by GitHub
parent 6e3af65749
commit 4b1057efaf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 28 additions and 12 deletions

View file

@ -170,10 +170,10 @@ const markupMath: textmate.Pattern = {
const markupHeading: textmate.Pattern = { const markupHeading: textmate.Pattern = {
name: "markup.heading.typst", name: "markup.heading.typst",
begin: /^\s*=+\s+/, begin: /^\s*(=+)(?:(?=[\r\n]|$)|\s+)/,
end: /\n|(?=<)/, end: /\n|(?=<)/,
beginCaptures: { beginCaptures: {
"0": { "1": {
name: "punctuation.definition.heading.typst", name: "punctuation.definition.heading.typst",
}, },
}, },

View file

@ -12,63 +12,73 @@
# ^ source.typst meta.expr.set.typst meta.expr.call.typst string.quoted.double.typst punctuation.definition.string.typst # ^ source.typst meta.expr.set.typst meta.expr.call.typst string.quoted.double.typst punctuation.definition.string.typst
# ^ source.typst meta.expr.set.typst meta.expr.call.typst meta.brace.round.typst # ^ source.typst meta.expr.set.typst meta.expr.call.typst meta.brace.round.typst
>= <test> >= <test>
#^^ source.typst markup.heading.typst punctuation.definition.heading.typst #^ source.typst markup.heading.typst punctuation.definition.heading.typst
# ^ source.typst markup.heading.typst
# ^^^^^^ source.typst entity.other.label.typst # ^^^^^^ source.typst entity.other.label.typst
>@test >@test
#^ source.typst entity.other.reference.typst punctuation.definition.reference.typst #^ source.typst entity.other.reference.typst punctuation.definition.reference.typst
# ^^^^ source.typst entity.other.reference.typst # ^^^^ source.typst entity.other.reference.typst
>= <test-> >= <test->
#^^ source.typst markup.heading.typst punctuation.definition.heading.typst #^ source.typst markup.heading.typst punctuation.definition.heading.typst
# ^ source.typst markup.heading.typst
# ^^^^^^^ source.typst entity.other.label.typst # ^^^^^^^ source.typst entity.other.label.typst
>@test- >@test-
#^ source.typst entity.other.reference.typst punctuation.definition.reference.typst #^ source.typst entity.other.reference.typst punctuation.definition.reference.typst
# ^^^^^ source.typst entity.other.reference.typst # ^^^^^ source.typst entity.other.reference.typst
>= <test:> >= <test:>
#^^ source.typst markup.heading.typst punctuation.definition.heading.typst #^ source.typst markup.heading.typst punctuation.definition.heading.typst
# ^ source.typst markup.heading.typst
# ^^^^^^^ source.typst entity.other.label.typst # ^^^^^^^ source.typst entity.other.label.typst
>@test: >@test:
#^ source.typst entity.other.reference.typst punctuation.definition.reference.typst #^ source.typst entity.other.reference.typst punctuation.definition.reference.typst
# ^^^^^ source.typst entity.other.reference.typst # ^^^^^ source.typst entity.other.reference.typst
>= <test.> >= <test.>
#^^ source.typst markup.heading.typst punctuation.definition.heading.typst #^ source.typst markup.heading.typst punctuation.definition.heading.typst
# ^ source.typst markup.heading.typst
# ^^^^^^^ source.typst entity.other.label.typst # ^^^^^^^ source.typst entity.other.label.typst
>@test. >@test.
#^ source.typst entity.other.reference.typst punctuation.definition.reference.typst #^ source.typst entity.other.reference.typst punctuation.definition.reference.typst
# ^^^^^ source.typst entity.other.reference.typst # ^^^^^ source.typst entity.other.reference.typst
>= <test.1> >= <test.1>
#^^ source.typst markup.heading.typst punctuation.definition.heading.typst #^ source.typst markup.heading.typst punctuation.definition.heading.typst
# ^ source.typst markup.heading.typst
# ^^^^^^^^ source.typst entity.other.label.typst # ^^^^^^^^ source.typst entity.other.label.typst
>@test.1 >@test.1
#^ source.typst entity.other.reference.typst punctuation.definition.reference.typst #^ source.typst entity.other.reference.typst punctuation.definition.reference.typst
# ^^^^^^ source.typst entity.other.reference.typst # ^^^^^^ source.typst entity.other.reference.typst
>= <test:1> >= <test:1>
#^^ source.typst markup.heading.typst punctuation.definition.heading.typst #^ source.typst markup.heading.typst punctuation.definition.heading.typst
# ^ source.typst markup.heading.typst
# ^^^^^^^^ source.typst entity.other.label.typst # ^^^^^^^^ source.typst entity.other.label.typst
>@test:1 >@test:1
#^ source.typst entity.other.reference.typst punctuation.definition.reference.typst #^ source.typst entity.other.reference.typst punctuation.definition.reference.typst
# ^^^^^^ source.typst entity.other.reference.typst # ^^^^^^ source.typst entity.other.reference.typst
>= <test::> >= <test::>
#^^ source.typst markup.heading.typst punctuation.definition.heading.typst #^ source.typst markup.heading.typst punctuation.definition.heading.typst
# ^ source.typst markup.heading.typst
# ^^^^^^^^ source.typst entity.other.label.typst # ^^^^^^^^ source.typst entity.other.label.typst
>@test:: >@test::
#^ source.typst entity.other.reference.typst punctuation.definition.reference.typst #^ source.typst entity.other.reference.typst punctuation.definition.reference.typst
# ^^^^ source.typst entity.other.reference.typst # ^^^^ source.typst entity.other.reference.typst
# ^^^ source.typst # ^^^ source.typst
>= <typst::World> >= <typst::World>
#^^ source.typst markup.heading.typst punctuation.definition.heading.typst #^ source.typst markup.heading.typst punctuation.definition.heading.typst
# ^ source.typst markup.heading.typst
# ^^^^^^^^^^^^^^ source.typst entity.other.label.typst # ^^^^^^^^^^^^^^ source.typst entity.other.label.typst
>@typst::World >@typst::World
#^ source.typst entity.other.reference.typst punctuation.definition.reference.typst #^ source.typst entity.other.reference.typst punctuation.definition.reference.typst
# ^^^^^^^^^^^^ source.typst entity.other.reference.typst # ^^^^^^^^^^^^ source.typst entity.other.reference.typst
>= <test::.> >= <test::.>
#^^ source.typst markup.heading.typst punctuation.definition.heading.typst #^ source.typst markup.heading.typst punctuation.definition.heading.typst
# ^ source.typst markup.heading.typst
# ^^^^^^^^^ source.typst entity.other.label.typst # ^^^^^^^^^ source.typst entity.other.label.typst
>@test::. e >@test::. e
#^ source.typst entity.other.reference.typst punctuation.definition.reference.typst #^ source.typst entity.other.reference.typst punctuation.definition.reference.typst
# ^^^^ source.typst entity.other.reference.typst # ^^^^ source.typst entity.other.reference.typst
# ^^^^^^ source.typst # ^^^^^^ source.typst
>= <test: :.> >= <test: :.>
#^^ source.typst markup.heading.typst punctuation.definition.heading.typst #^ source.typst markup.heading.typst punctuation.definition.heading.typst
# ^ source.typst markup.heading.typst
# ^^^^^^^^^^^ source.typst # ^^^^^^^^^^^ source.typst
>@test: :. e >@test: :. e
#^ source.typst entity.other.reference.typst punctuation.definition.reference.typst #^ source.typst entity.other.reference.typst punctuation.definition.reference.typst

View file

@ -0,0 +1,2 @@
===
test

View file

@ -0,0 +1,4 @@
>===
#^^^ source.typst markup.heading.typst punctuation.definition.heading.typst
>test
#^^^^^ source.typst