diff --git a/package.json b/package.json index 2323817..584fc10 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "language-configuration.json", "LICENSE", "syntaxes/hsml.tmLanguage.json", + "syntaxes/markdown-hsml.tmLanguage.json", "syntaxes/vue-hsml.tmLanguage.json" ], "type": "module", @@ -91,9 +92,23 @@ "embeddedLanguages": { "text.hsml": "hsml" } + }, + { + "language": "hsml-markdown-injection", + "scopeName": "markdown.hsml.codeblock", + "path": "./syntaxes/markdown-hsml.tmLanguage.json", + "injectTo": [ + "text.html.markdown" + ], + "embeddedLanguages": { + "meta.embedded.block.hsml": "hsml" + } } ], "languages": [ + { + "id": "hsml-markdown-injection" + }, { "id": "hsml", "aliases": [ diff --git a/syntaxes/markdown-hsml.tmLanguage.json b/syntaxes/markdown-hsml.tmLanguage.json new file mode 100644 index 0000000..4a9e8f7 --- /dev/null +++ b/syntaxes/markdown-hsml.tmLanguage.json @@ -0,0 +1,45 @@ +{ + "fileTypes": [], + "injectionSelector": "L:text.html.markdown", + "patterns": [ + { + "include": "#hsml-code-block" + } + ], + "repository": { + "hsml-code-block": { + "begin": "(^|\\G)(\\s*)(\\`{3,}|~{3,})\\s*(?i:(hsml)(\\s+[^`~]*)?$)", + "name": "markup.fenced_code.block.markdown", + "end": "(^|\\G)(\\2|\\s{0,3})(\\3)\\s*$", + "beginCaptures": { + "3": { + "name": "punctuation.definition.markdown" + }, + "4": { + "name": "fenced_code.block.language.markdown" + }, + "5": { + "name": "fenced_code.block.language.attributes.markdown" + } + }, + "endCaptures": { + "3": { + "name": "punctuation.definition.markdown" + } + }, + "patterns": [ + { + "begin": "(^|\\G)(\\s*)(.*)", + "while": "(^|\\G)(?!\\s*([`~]{3,})\\s*$)", + "contentName": "meta.embedded.block.hsml", + "patterns": [ + { + "include": "text.hsml" + } + ] + } + ] + } + }, + "scopeName": "markdown.hsml.codeblock" +}