forked from sveltejs/language-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(fix) Handle syntax highlighting for most markdown files
Mostly fixes sveltejs#1094. Do this by injecting rules to parse typescript and css for svelte script/style blocks inside markdown only. This should cover *most* cases of embedded svelte blocks inside markdown. It would not be *too* difficult to extend this further to handle other types of embedded script/style tags (as is done in the original grammar), though it would be somewhat tedious.
- Loading branch information
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"scopeName": "markdown.svelte.codeblock.style", | ||
"fileTypes": [], | ||
"injectionSelector": "L:meta.style.svelte", | ||
"patterns": [ | ||
{ | ||
"include": "#svelte-script-css" | ||
} | ||
], | ||
"repository": { | ||
"svelte-script-css": { | ||
"begin": "(?<=style.*>)(?!</)", | ||
"end": "(?=</)", | ||
"name": "meta.embedded.block.svelte.style", | ||
"contentName": "source.css", | ||
"patterns": [ | ||
{ | ||
"include": "source.css" | ||
} | ||
] | ||
} | ||
} | ||
} |
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,23 @@ | ||
{ | ||
"scopeName": "markdown.svelte.codeblock.script", | ||
"fileTypes": [], | ||
"injectionSelector": "L:meta.script.svelte", | ||
"patterns": [ | ||
{ | ||
"include": "#svelte-script-js" | ||
} | ||
], | ||
"repository": { | ||
"svelte-script-js": { | ||
"begin": "(?<=script.*>)(?!</)", | ||
"end": "(?=</)", | ||
"name": "meta.embedded.block.svelte.script", | ||
"contentName": "source.ts", | ||
"patterns": [ | ||
{ | ||
"include": "source.ts" | ||
} | ||
] | ||
} | ||
} | ||
} |