Skip to content

Commit

Permalink
Add syntax highlighting for markdown fenced code block
Browse files Browse the repository at this point in the history
  • Loading branch information
LitoMore authored and Vexu committed Jul 21, 2022
1 parent 219e970 commit ac25b33
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
11 changes: 11 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@
"language": "zig",
"scopeName": "source.zig",
"path": "./syntaxes/zig.tmLanguage.json"
},
{
"language": "zig",
"scopeName": "markdown.zig.codeblock",
"path": "./syntaxes/codeblock.json",
"injectTo": [
"text.html.markdown"
],
"embeddedLanguages": {
"meta.embedded.block.zig": "zig"
}
}
],
"problemMatchers": [
Expand Down
45 changes: 45 additions & 0 deletions syntaxes/codeblock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"fileTypes": [],
"injectionSelector": "L:text.html.markdown",
"patterns": [
{
"include": "#zig-code-block"
}
],
"repository": {
"zig-code-block": {
"begin": "(^|\\G)(\\s*)(\\`{3,}|~{3,})\\s*(?i:(zig)(\\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.zig",
"patterns": [
{
"include": "source.zig"
}
]
}
]
}
},
"scopeName": "markdown.zig.codeblock"
}

0 comments on commit ac25b33

Please sign in to comment.