-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Attempt to highlight astro code blocks as HTML
The goal is to try and make code blocks tagged as astro as HTML. ````mdx Below should be highlighted as HTML ```astro <div></div> ``` ```` This is intended to be a proof of concept for injecting custom languages into MDX code blocks, not to support all sorts of languages in the MDX extension by default.
- Loading branch information
1 parent
8ce92a0
commit 5bf2a46
Showing
3 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"fileTypes": [], | ||
"injectionSelector": "L:source.mdx", | ||
"patterns": [ | ||
{ | ||
"include": "#html-code-block" | ||
} | ||
], | ||
"repository": { | ||
"html-code-block": { | ||
"begin": "(^|\\G)(\\s*)(\\`{3,}|~{3,})\\s*(?i:(astro)", | ||
"name": "markup.code.other.mdx", | ||
"end": "(^|\\G)(\\2|\\s{0,3})(\\3)\\s*$", | ||
"beginCaptures": { | ||
"3": { | ||
"name": "string.other.begin.code.fenced.mdx" | ||
}, | ||
"4": { | ||
"name": "entity.name.function.mdx" | ||
} | ||
}, | ||
"endCaptures": { | ||
"3": { | ||
"name": "string.other.end.code.fenced.mdx" | ||
} | ||
}, | ||
"patterns": [ | ||
{ | ||
"begin": "(^|\\G)(\\s*)(.*)", | ||
"while": "(^|\\G)(?!\\s*([`~]{3,})\\s*$)", | ||
"contentName": "meta.embedded.block.html", | ||
"patterns": [ | ||
{ | ||
"include": "source.html" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
}, | ||
"scopeName": "mdx.html.codeblock" | ||
} |