From fe8c9eb6e65af6562f9f181f30f05961c4b11ede Mon Sep 17 00:00:00 2001 From: uncenter <47499684+uncenter@users.noreply.github.com> Date: Wed, 23 Oct 2024 17:38:10 -0400 Subject: [PATCH] feat: highlight yaml frontmatter --- syntaxes/tera.tmLanguage.json | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/syntaxes/tera.tmLanguage.json b/syntaxes/tera.tmLanguage.json index 46f6b9a..dcf4967 100644 --- a/syntaxes/tera.tmLanguage.json +++ b/syntaxes/tera.tmLanguage.json @@ -4,6 +4,9 @@ "scopeName": "source.tera", "fileTypes": ["tera"], "patterns": [ + { + "include": "#frontMatter" + }, { "begin": "{#-?", "captures": { @@ -306,6 +309,36 @@ "name": "constant.character.escape.tera" } ] + }, + "frontMatter": { + "applyEndPatternLast": 1, + "begin": "\\A(?=(-{3,}))", + "end": "^ {,3}\\1-*[ \\t]*$|^[ \\t]*\\.{3}$", + "endCaptures": { + "0": { + "name": "punctuation.definition.end.frontmatter" + } + }, + "patterns": [ + { + "begin": "\\A(-{3,})(.*)$", + "beginCaptures": { + "1": { + "name": "punctuation.definition.begin.frontmatter" + }, + "2": { + "name": "comment.frontmatter" + } + }, + "contentName": "meta.embedded.block.frontmatter", + "patterns": [ + { + "include": "source.yaml" + } + ], + "while": "^(?! {,3}\\1-*[ \\t]*$|[ \\t]*\\.{3}$)" + } + ] } } }