diff --git a/client/package.json b/client/package.json index 8cc59046..3ac07b31 100644 --- a/client/package.json +++ b/client/package.json @@ -115,6 +115,9 @@ ".sol" ], "configuration": "./language-configuration.json" + }, + { + "id": "solidity-markdown-injection" } ], "grammars": [ @@ -122,6 +125,17 @@ "language": "solidity", "scopeName": "source.solidity", "path": "./syntaxes/solidity.json" + }, + { + "language": "solidity-markdown-injection", + "scopeName": "markdown.solidity.codeblock", + "path": "./syntaxes/solidity-markdown-injection.json", + "injectTo": [ + "text.html.markdown" + ], + "embeddedLanguages": { + "meta.embedded.block.solidity": "solidity" + } } ], "snippets": [ diff --git a/client/syntaxes/solidity-markdown-injection.json b/client/syntaxes/solidity-markdown-injection.json new file mode 100644 index 00000000..52cae093 --- /dev/null +++ b/client/syntaxes/solidity-markdown-injection.json @@ -0,0 +1,45 @@ +{ + "fileTypes": [], + "injectionSelector": "L:text.html.markdown", + "patterns": [ + { + "include": "#solidity-code-block" + } + ], + "repository": { + "solidity-code-block": { + "begin": "(^|\\G)(\\s*)(\\`{3,}|~{3,})\\s*(?i:(solidity)(\\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.solidity", + "patterns": [ + { + "include": "source.solidity" + } + ] + } + ] + } + }, + "scopeName": "markdown.solidity.codeblock" +} \ No newline at end of file