Skip to content

Commit 88510bb

Browse files
Son Tran-Nguyensntran
authored andcommitted
Resolve #122 supporting Markdown Fenced Code Block
Syntax highlighting inside markdown code blocks: ```elixir Graph.match( from person in "Person", where: person.age < 32 and person.title == "Developer", join: friend in "Person", on: "FRIEND", join: fof, on: "FRIEND", join: work, on: "WORKED_WITH", select: {person.name, friend.name, fof.name, work.name} ) ``` Inspired by https://github.com/mjbvz/vscode-fenced-code-block-grammar-injection-example
1 parent bd64849 commit 88510bb

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@
5959
"language": "HTML (Eex)",
6060
"scopeName": "text.html.elixir",
6161
"path": "./syntaxes/html (eex).json"
62+
},
63+
{
64+
"scopeName": "markdown.elixir.codeblock",
65+
"path": "./syntaxes/codeblock.json",
66+
"injectTo": ["text.html.markdown"],
67+
"embeddedLanguages": {
68+
"meta.embedded.block.elixir": "elixir"
69+
}
6270
}
6371
],
6472
"snippets": [

syntaxes/codeblock.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"fileTypes": [],
3+
"injectionSelector": "L:markup.fenced_code.block.markdown",
4+
"patterns": [
5+
{
6+
"include": "#plantuml-code-block"
7+
}
8+
],
9+
"repository": {
10+
"plantuml-code-block": {
11+
"begin": "elixir(\\s+[^`~]*)?$",
12+
"end": "(^|\\G)(?=\\s*[`~]{3,}\\s*$)",
13+
"patterns": [
14+
{
15+
"begin": "(^|\\G)(\\s*)(.*)",
16+
"while": "(^|\\G)(?!\\s*([`~]{3,})\\s*$)",
17+
"contentName": "meta.embedded.block.elixir",
18+
"patterns": [
19+
{
20+
"include": "source.elixir"
21+
}
22+
]
23+
}
24+
]
25+
}
26+
},
27+
"scopeName": "markdown.elixir.codeblock"
28+
}

0 commit comments

Comments
 (0)