{ "name": "typst", "patterns": [ { "include": "#markup" } ], "repository": { "common": { "patterns": [ { "name": "comment.line.double-slash.typst", "begin": "//", "end": "\n", "beginCaptures": { "0": { "name": "punctuation.definition.comment.typst" } } }, { "name": "comment.block.typst", "begin": "/\\*", "end": "\\*/", "captures": { "0": { "name": "punctuation.definition.comment.typst" } }, "patterns": [{ "include": "$self" }] }, { "name": "meta.block.typst", "begin": "{", "end": "}", "captures": { "0": { "name": "punctuation.definition.block.typst" } }, "patterns": [{ "include": "#code" }] }, { "name": "meta.template.typst", "begin": "\\[", "end": "\\]", "captures": { "0": { "name": "punctuation.definition.template.typst" } }, "patterns": [{ "include": "#markup" }] } ] }, "markup": { "patterns": [ { "include": "#common" }, { "name": "constant.character.escape.content.typst", "match": "\\\\([\\\\/\\[\\]{}#*_=~`$-.]|u\\{[0-9a-zA-Z]*\\}?)" }, { "name": "markup.bold.typst", "begin": "\\*", "end": "\\*|(?=\\])", "captures": { "0": { "name": "punctuation.definition.bold.typst" } }, "patterns": [{ "include": "#markup" }] }, { "name": "markup.italic.typst", "begin": "_", "end": "_|(?=\\])", "captures": { "0": { "name": "punctuation.definition.italic.typst" } }, "patterns": [{ "include": "#markup" }] }, { "name": "punctuation.definition.linebreak.typst", "match": "\\\\" }, { "name": "punctuation.definition.em-dash.typst", "match": "---" }, { "name": "punctuation.definition.en-dash.typst", "match": "--" }, { "name": "punctuation.definition.nonbreaking-space.typst", "match": "~" }, { "name": "markup.heading.typst", "contentName": "entity.name.section.typst", "begin": "^\\s*#{1,6}\\s+", "end": "\n", "beginCaptures": { "0": { "name": "punctuation.definition.heading.typst" } }, "patterns": [{ "include": "#markup" }] }, { "name": "punctuation.definition.list.unnumbered.typst", "match": "^\\s*-\\s+" }, { "name": "punctuation.definition.list.numbered.typst", "match": "^\\s*[0-9]*\\.\\s+" }, { "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": "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": "keyword.control.typst", "match": "(#)(break|continue|return)\\b", "captures": { "1": { "name": "punctuation.definition.keyword.typst" } } }, { "name": "keyword.other.typst", "match": "(#)(in|using|as)\\b", "captures": { "1": { "name": "punctuation.definition.keyword.typst" } } }, { "begin": "(#)(pub|let)\\b", "end": "\n|(;)|(?=])|(?<=}|])", "beginCaptures": { "0": { "name": "keyword.other.typst" }, "1": { "name": "punctuation.definition.keyword.typst" } }, "endCaptures": { "1": { "name": "punctuation.terminator.statement.typst" } }, "patterns": [{ "include": "#code" }] }, { "begin": "(#)(if|else)\\b", "end": "\n|(?=])|(?<=}|])", "beginCaptures": { "0": { "name": "keyword.control.conditional.typst" }, "1": { "name": "punctuation.definition.keyword.typst" } }, "patterns": [{ "include": "#code" }] }, { "begin": "(#)(for|while)\\b", "end": "\n|(?=])|(?<=}|])", "beginCaptures": { "0": { "name": "keyword.control.typst" }, "1": { "name": "punctuation.definition.keyword.typst" } }, "patterns": [{ "include": "#code" }] }, { "begin": "(#)import\\b", "end": "\n|(?=])", "beginCaptures": { "0": { "name": "keyword.control.import.typst" }, "1": { "name": "punctuation.definition.keyword.typst" } }, "patterns": [{ "include": "#code" }] }, { "begin": "(#)include\\b", "end": "\n|(?=])", "beginCaptures": { "0": { "name": "keyword.control.include.typst" }, "1": { "name": "punctuation.definition.keyword.typst" } }, "patterns": [{ "include": "#code" }] }, { "comment": "Function name", "name": "entity.name.function.typst", "match": "((#)[[:alpha:]_][[:alnum:]_-]*!?)(?=\\[|\\()", "captures": { "2": { "name": "punctuation.definition.function.typst" } } }, { "comment": "Function arguments", "begin": "(?<=#[[:alpha:]_][[:alnum:]_-]*!?)\\(", "end": "\\)", "captures": { "0": { "name": "punctuation.definition.group.typst" } }, "patterns": [{ "include": "#arguments" }] }, { "name": "variable.interpolated.typst", "match": "(#)[[:alpha:]_][[:alnum:]_-]*", "captures": { "1": { "name": "punctuation.definition.variable.typst" } } } ] }, "code": { "patterns": [ { "include": "#common" }, { "name": "punctuation.separator.colon.typst", "match": ":" }, { "name": "punctuation.separator.comma.typst", "match": "," }, { "name": "keyword.operator.typst", "match": "=>|\\.\\." }, { "name": "keyword.operator.relational.typst", "match": "==|!=|<=|<|>=|>" }, { "name": "keyword.operator.assignment.typst", "match": "\\+=|-=|\\*=|/=|=" }, { "name": "keyword.operator.arithmetic.typst", "match": "\\+|\\*!?|/|(?