diff --git a/src/syntax/highlight.rs b/src/syntax/highlight.rs index de7c70a2f..4a4534808 100644 --- a/src/syntax/highlight.rs +++ b/src/syntax/highlight.rs @@ -389,7 +389,7 @@ impl Category { Self::Math => "string.other.math.typst", Self::Heading => "markup.heading.typst", Self::List => "markup.list.typst", - Self::Term => "markup.bold.typst", + Self::Term => "markup.list.term.typst", Self::Label => "entity.name.label.typst", Self::Ref => "markup.other.reference.typst", Self::Keyword => "keyword.typst", diff --git a/tools/support/typst.tmLanguage.json b/tools/support/typst.tmLanguage.json index f493cc5ba..7a1c8458d 100644 --- a/tools/support/typst.tmLanguage.json +++ b/tools/support/typst.tmLanguage.json @@ -48,6 +48,30 @@ "name": "constant.character.escape.content.typst", "match": "\\\\([\\\\/\\[\\]{}#*_=~`$-.]|u\\{[0-9a-zA-Z]*\\}?)" }, + { + "name": "punctuation.definition.linebreak.typst", + "match": "\\\\" + }, + { + "name": "punctuation.definition.nonbreaking-space.typst", + "match": "~" + }, + { + "name": "punctuation.definition.shy.typst", + "match": "-\\?" + }, + { + "name": "punctuation.definition.em-dash.typst", + "match": "---" + }, + { + "name": "punctuation.definition.en-dash.typst", + "match": "--" + }, + { + "name": "punctuation.definition.ellipsis.typst", + "match": "\\.\\.\\." + }, { "name": "markup.bold.typst", "begin": "(^\\*|\\*$|((?<=\\W|_)\\*)|(\\*(?=\\W|_)))", @@ -63,20 +87,26 @@ "patterns": [{ "include": "#markup" }] }, { - "name": "punctuation.definition.linebreak.typst", - "match": "\\\\" + "name": "markup.underline.link.typst", + "match": "https?://[0-9a-zA-Z~/%#&=',;\\.\\+\\?]*" }, { - "name": "punctuation.definition.em-dash.typst", - "match": "---" + "name": "markup.raw.block.typst", + "begin": "`{3,}", + "end": "\\0", + "captures": { "0": { "name": "punctuation.definition.raw.typst" } } }, { - "name": "punctuation.definition.en-dash.typst", - "match": "--" + "name": "markup.raw.inline.typst", + "begin": "`", + "end": "`", + "captures": { "0": { "name": "punctuation.definition.raw.typst" } } }, { - "name": "punctuation.definition.nonbreaking-space.typst", - "match": "~" + "name": "string.other.math.typst", + "begin": "\\$", + "end": "\\$", + "captures": { "0": { "name": "punctuation.defintion.string.math.typst" } } }, { "name": "markup.heading.typst", @@ -92,42 +122,25 @@ }, { "name": "punctuation.definition.list.numbered.typst", - "match": "^\\s*[0-9]*\\.\\s+" + "match": "^\\s*([0-9]*\\.|\\+)\\s+" }, { - "name": "markup.raw.block.typst", - "begin": "`{3,}", - "end": "\\0", - "captures": { "0": { "name": "punctuation.definition.raw.typst" } } - }, - { - "name": "markup.raw.inline.typst", - "begin": "`", - "end": "`", - "captures": { "0": { "name": "punctuation.definition.raw.typst" } } - }, - { - "name": "string.other.math.block.typst", - "begin": "\\$\\[", - "end": "\\]\\$", - "captures": { "0": { "name": "punctuation.defintion.string.math.typst" } } - }, - { - "name": "string.other.math.typst", - "begin": "\\$", - "end": "\\$", - "captures": { "0": { "name": "punctuation.defintion.string.math.typst" } } - }, - { - "name": "entity.other.reference.typst", - "match": "(@)[[:alpha:]_][[:alnum:]_-]*", - "captures": { "1": { "name": "punctuation.definition.reference.typst" } } + "match": "^\\s*(/)\\s+([^:]*:)", + "captures": { + "1": { "name": "punctuation.definition.list.description.typst" }, + "2": { "name": "markup.list.term.typst" } + } }, { "name": "entity.other.label.typst", "match": "<[[:alpha:]_][[:alnum:]_-]*>", "captures": { "1": { "name": "punctuation.definition.label.typst" } } }, + { + "name": "entity.other.reference.typst", + "match": "(@)[[:alpha:]_][[:alnum:]_-]*", + "captures": { "1": { "name": "punctuation.definition.reference.typst" } } + }, { "begin": "(#)(pub|let|set|show|wrap)\\b", "end": "\n|(;)|(?=])",