Skip to content

Commit

Permalink
Inject html syntax highlighting via language=html comment
Browse files Browse the repository at this point in the history
Signed-off-by: Fred Bricon <[email protected]>
  • Loading branch information
fbricon authored and rgrunber committed Jan 17, 2024
1 parent b59c43a commit fa2a63c
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
44 changes: 44 additions & 0 deletions language-support/html/inline-html.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"injectionSelector": "L:source.java -comment -string",
"patterns": [
{
"contentName": "meta.embedded.block.html",
"begin": "(?i)((/\\*\\s*(language=html)\\s*\\*/)|((//\\s*(language=html)\\s*)))",
"beginCaptures": {
"1": {
"name": "comment.block"
}
},
"end": "(?<=\")",
"patterns": [
{
"begin": "\\s*(\"\"\")$",
"beginCaptures": {
"0": { "name": "string.quoted.triple.java" }
},
"end": "\\s*(\"\"\")",
"endCaptures": {
"0": { "name": "string.quoted.triple.java" }
},
"patterns": [
{ "include": "text.html.derivative" }
]
},
{
"begin": "\\s*(\")",
"beginCaptures": {
"0": { "name": "string.quoted.double.java" }
},
"end": "\\s*(\")",
"endCaptures": {
"0": { "name": "string.quoted.double.java" }
},
"patterns": [
{ "include": "text.html.derivative" }
]
}
]
}
],
"scopeName": "inline.html"
}
10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,16 @@
"embeddedLanguages": {
"meta.embedded.block.yaml": "yaml"
}
},
{
"injectTo": [
"source.java"
],
"scopeName": "inline.html",
"path": "./language-support/html/inline-html.json",
"embeddedLanguages": {
"meta.embedded.block.html": "html"
}
}
],
"jsonValidation": [
Expand Down

0 comments on commit fa2a63c

Please sign in to comment.