From 8cd431d97f067c274aff99c1ad54fce54957c69d Mon Sep 17 00:00:00 2001 From: Diogo Nunes Date: Sat, 12 Dec 2020 18:37:29 +0000 Subject: [PATCH 1/2] feat: syntax highlight in *.MD code blocks --- syntaxes/codeblock.json | 45 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 syntaxes/codeblock.json diff --git a/syntaxes/codeblock.json b/syntaxes/codeblock.json new file mode 100644 index 0000000..f5298c9 --- /dev/null +++ b/syntaxes/codeblock.json @@ -0,0 +1,45 @@ +{ + "fileTypes": [], + "injectionSelector": "L:text.html.markdown", + "patterns": [ + { + "include": "#feature-code-block" + } + ], + "repository": { + "feature-code-block": { + "begin": "(^|\\G)(\\s*)(\\`{3,}|~{3,})\\s*(?i:(feature)(\\s+[^`~]*)?$)", + "name": "markup.fenced_code.block.markdown", + "end": "(^|\\G)(\\2|\\s{0,3})(\\3)\\s*$", + "beginCaptures": { + "3": { + "name": "punctuation.definition.markdown" + }, + "5": { + "name": "fenced_code.block.language" + }, + "6": { + "name": "fenced_code.block.language.attributes" + } + }, + "endCaptures": { + "3": { + "name": "punctuation.definition.markdown" + } + }, + "patterns": [ + { + "begin": "(^|\\G)(\\s*)(.*)", + "while": "(^|\\G)(?!\\s*([`~]{3,})\\s*$)", + "contentName": "meta.embedded.block.feature", + "patterns": [ + { + "include": "text.gherkin.feature" + } + ] + } + ] + } + }, + "scopeName": "text.gherkin.feature" +} From 86c9ed34ee095e65ef514c556a02b5c3129bf9d6 Mon Sep 17 00:00:00 2001 From: Diogo Nunes Date: Sat, 19 Dec 2020 18:49:42 +0000 Subject: [PATCH 2/2] fix: add ref to new codeblock grammar in package.json --- package.json | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/package.json b/package.json index 895100e..700af36 100644 --- a/package.json +++ b/package.json @@ -57,6 +57,13 @@ "injectTo": [ "text.html.markdown" ] + }, + { + "scopeName": "markdown.feature.codeblock", + "path": "./syntaxes/codeblock.json", + "injectTo": [ + "text.html.markdown" + ] } ], "snippets": [