Skip to content

Commit fa2a63c

Browse files
fbriconrgrunber
authored andcommitted
Inject html syntax highlighting via language=html comment
Signed-off-by: Fred Bricon <[email protected]>
1 parent b59c43a commit fa2a63c

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"injectionSelector": "L:source.java -comment -string",
3+
"patterns": [
4+
{
5+
"contentName": "meta.embedded.block.html",
6+
"begin": "(?i)((/\\*\\s*(language=html)\\s*\\*/)|((//\\s*(language=html)\\s*)))",
7+
"beginCaptures": {
8+
"1": {
9+
"name": "comment.block"
10+
}
11+
},
12+
"end": "(?<=\")",
13+
"patterns": [
14+
{
15+
"begin": "\\s*(\"\"\")$",
16+
"beginCaptures": {
17+
"0": { "name": "string.quoted.triple.java" }
18+
},
19+
"end": "\\s*(\"\"\")",
20+
"endCaptures": {
21+
"0": { "name": "string.quoted.triple.java" }
22+
},
23+
"patterns": [
24+
{ "include": "text.html.derivative" }
25+
]
26+
},
27+
{
28+
"begin": "\\s*(\")",
29+
"beginCaptures": {
30+
"0": { "name": "string.quoted.double.java" }
31+
},
32+
"end": "\\s*(\")",
33+
"endCaptures": {
34+
"0": { "name": "string.quoted.double.java" }
35+
},
36+
"patterns": [
37+
{ "include": "text.html.derivative" }
38+
]
39+
}
40+
]
41+
}
42+
],
43+
"scopeName": "inline.html"
44+
}

package.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,16 @@
252252
"embeddedLanguages": {
253253
"meta.embedded.block.yaml": "yaml"
254254
}
255+
},
256+
{
257+
"injectTo": [
258+
"source.java"
259+
],
260+
"scopeName": "inline.html",
261+
"path": "./language-support/html/inline-html.json",
262+
"embeddedLanguages": {
263+
"meta.embedded.block.html": "html"
264+
}
255265
}
256266
],
257267
"jsonValidation": [

0 commit comments

Comments
 (0)