Skip to content

Commit

Permalink
feat: support markdown syntax highlighting (#112)
Browse files Browse the repository at this point in the history
* feat: support markdown syntax highlighting

Add's support for kusto syntax highlighting in markdown fenced
code blocks

Valid language names are kusto, kql, csl

Resolves: #93

* feat: add kusto logo to file

Add a dark mode variant with higher contrast

* fix: support csl fence block
  • Loading branch information
Caleb-Wishart committed Aug 8, 2023
1 parent 1b15e80 commit db77b2b
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 1 deletion.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 15 additions & 1 deletion kusto-syntax-highlighting/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,28 @@
".kusto",
".kql"
],
"configuration": "./language-configuration.json"
"configuration": "./language-configuration.json",
"icon": {
"light": "./images/kusto_logo.png",
"dark": "./images/kusto_logo_dark.png"
}
}
],
"grammars": [
{
"language": "kusto",
"scopeName": "source.kusto",
"path": "./syntaxes/kusto.tmLanguage.json"
},
{
"scopeName": "markdown.kusto.codeblock",
"path": "./syntaxes/kusto-markdown-codeblock.json",
"injectTo": [
"text.html.markdown"
],
"embeddedLanguages": {
"meta.embedded.block.kusto": "kusto"
}
}
]
},
Expand Down
45 changes: 45 additions & 0 deletions kusto-syntax-highlighting/syntaxes/kusto-markdown-codeblock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"fileTypes": [],
"injectionSelector": "L:text.html.markdown",
"patterns": [
{
"include": "#fenced_code_block_kusto"
}
],
"repository": {
"fenced_code_block_kusto": {
"name": "markup.fenced_code.block.markdown",
"begin": "(^|\\G)(\\s*)(\\`{3,}|~{3,})\\s*(?i:(kusto|kql|csl)(\\s+[^`~]*)?$)",
"end": "(^|\\G)(?=\\s*[`~]{3,}\\s*$)",
"beginCaptures": {
"3": {
"name": "punctuation.definition.markdown"
},
"4": {
"name": "fenced_code.block.language.markdown"
},
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
"3": {
"name": "punctuation.definition.markdown"
}
},
"patterns": [
{
"begin": "(^|\\G)(\\s*)(.*)",
"while": "(^|\\G)(?!\\s*([`~]{3,})\\s*$)",
"contentName": "meta.embedded.block.kusto",
"patterns": [
{
"include": "source.kusto"
}
]
}
]
}
},
"scopeName": "markdown.kusto.codeblock"
}

0 comments on commit db77b2b

Please sign in to comment.