Skip to content

Commit

Permalink
Fix for terrastruct#119
Browse files Browse the repository at this point in the history
  • Loading branch information
BarryNolte committed Aug 29, 2023
1 parent a6972e3 commit 84f7348
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
14 changes: 14 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@
},
{
"id": "markdown.d2"
},
{
"id": "d2-markdown-injection"
}
],
"grammars": [
Expand All @@ -84,6 +87,17 @@
"language": "markdown.d2",
"scopeName": "text.html.markdown.d2",
"path": "./syntaxes/markdown.tmLanguage.json"
},
{
"language": "d2-markdown-injection",
"scopeName": "markdown.d2.codeblock",
"path": "./syntaxes/d2-markdown-injection.json",
"injectTo": [
"text.html.markdown"
],
"embeddedLanguages": {
"meta.embedded.block.d2": "d2"
}
}
],
"markdown.markdownItPlugins": true,
Expand Down
45 changes: 45 additions & 0 deletions syntaxes/d2-markdown-injection.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"fileTypes": [],
"injectionSelector": "L:text.html.markdown",
"patterns": [
{
"include": "#d2-code-block"
}
],
"repository": {
"d2-code-block": {
"begin": "(^|\\G)(\\s*)(\\`{3,}|~{3,})\\s*(?i:(d2)(\\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.d2",
"patterns": [
{
"include": "source.d2"
}
]
}
]
}
},
"scopeName": "markdown.d2.codeblock"
}

0 comments on commit 84f7348

Please sign in to comment.