Skip to content
This repository was archived by the owner on Jul 31, 2022. It is now read-only.

Commit 8b75899

Browse files
authored
feat: support highlighting markdown fenced code blocks (#243)
Derived from github.com/kumarharsh/graphql-for-vscode@22d83155524a8c5b3c32d2ba5024d4882070fc69
1 parent 52e3b52 commit 8b75899

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Lots of new improvements happening! We now have a [`CHANGELOG.md`](https://githu
1515
- Load the extension on detecting `graphql-config file` at root level or in a parent level directory
1616
- Load the extension in `.graphql`, `.gql files`
1717
- Load the extension on detecting `gql` tag in js, ts, jsx, tsx, vue files
18+
- Load the extension inside `gql`/`graphql` fenced code blocks in markdown files
1819
- execute query/mutation/subscription operation, embedded or in graphql files
1920
- pre-load schema and document defintitions
2021
- Support [`graphql-config`](https://graphql-config.com/) files with one project and multiple projects
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"fileTypes": [],
3+
"scopeName": "markdown.graphql.codeblock",
4+
"injectionSelector": "L:markup.fenced_code.block.markdown",
5+
"patterns": [
6+
{
7+
"contentName": "meta.embedded.block.graphql",
8+
"begin": "(gql|graphql|GraphQL)(\\s+[^`~]*)?$",
9+
"end": "(^|\\G)(?=\\s*[`~]{3,}\\s*$)",
10+
"patterns": [
11+
{
12+
"begin": "(^|\\G)(\\s*)(.*)",
13+
"while": "(^|\\G)(?!\\s*([`~]{3,})\\s*$)",
14+
"patterns": [
15+
{
16+
"include": "source.graphql"
17+
}
18+
]
19+
}
20+
]
21+
}
22+
]
23+
}

package.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,16 @@
7676
"embeddedLanguages": {
7777
"meta.embedded.block.graphql": "graphql"
7878
}
79+
},
80+
{
81+
"injectTo": [
82+
"text.html.markdown"
83+
],
84+
"scopeName": "markdown.graphql.codeblock",
85+
"path": "./grammars/graphql.markdown.codeblock.json",
86+
"embeddedLanguages": {
87+
"meta.embedded.block.graphql": "graphql"
88+
}
7989
}
8090
],
8191
"snippets": [

0 commit comments

Comments
 (0)