Highlight some basic markdown elements in js/ts fenced code blocks

Fixes #63942
This commit is contained in:
Matt Bierner 2018-11-28 15:52:49 -08:00
parent 72ece3c7ee
commit 5df76d3535
3 changed files with 2481 additions and 2446 deletions

View file

@ -4,7 +4,7 @@
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
"Once accepted there, we are happy to receive an update request."
],
"version": "https://github.com/microsoft/vscode-markdown-tm-grammar/commit/97b45ff162bfccd4770a0f6851e7d7937fc884b6",
"version": "https://github.com/microsoft/vscode-markdown-tm-grammar/commit/a595d8ba2ae9ce8864435d33db2afa0fe68b1487",
"name": "Markdown",
"scopeName": "text.html.markdown",
"patterns": [
@ -45,8 +45,8 @@
{
"include": "#paragraph"
}
],
"repository": {
]
},
"blockquote": {
"begin": "(^|\\G)[ ]{0,3}(>) ?",
"captures": {
@ -2147,8 +2147,6 @@
"separator": {
"match": "(^|\\G)[ ]{0,3}([\\*\\-\\_])([ ]{0,2}\\2){2,}[ \\t]*$\\n?",
"name": "meta.separator.markdown"
}
}
},
"frontMatter": {
"begin": "\\A-{3}\\s*$",
@ -2204,15 +2202,15 @@
{
"include": "#link-ref-shortcut"
}
],
"repository": {
]
},
"ampersand": {
"comment": "Markdown will convert this for us. We match it so that the HTML grammar will not mark it up as invalid.",
"match": "&(?!([a-zA-Z0-9]+|#[0-9]+|#x[0-9a-fA-F]+);)",
"name": "meta.other.valid-ampersand.markdown"
},
"bold": {
"begin": "(?x)\n (\\*\\*(?=\\w)|(?<!\\w)\\*\\*|(?<!\\w)\\b__)(?=\\S) # Open\n (?=\n (\n <[^>]*+> # HTML tags\n | (?<raw>`+)([^`]|(?!(?<!`)\\k<raw>(?!`))`)*+\\k<raw>\n # Raw\n | \\\\[\\\\`*_{}\\[\\]()#.!+\\->]?+ # Escapes\n | \\[\n (\n (?<square> # Named group\n [^\\[\\]\\\\] # Match most chars\n | \\\\. # Escaped chars\n | \\[ \\g<square>*+ \\] # Nested brackets\n )*+\n \\]\n (\n ( # Reference Link\n [ ]? # Optional space\n \\[[^\\]]*+\\] # Ref name\n )\n | ( # Inline Link\n \\( # Opening paren\n [ \\t]*+ # Optional whitespace\n <?(.*?)>? # URL\n [ \\t]*+ # Optional whitespace\n ( # Optional Title\n (?<title>['\"])\n (.*?)\n \\k<title>\n )?\n \\)\n )\n )\n )\n | (?!(?<=\\S)\\1). # Everything besides\n # style closer\n )++\n (?<=\\S)(?=__\\b|\\*\\*)\\1 # Close\n )\n",
"begin": "(?x) (\\*\\*(?=\\w)|(?<!\\w)\\*\\*|(?<!\\w)\\b__)(?=\\S) (?=\n (\n <[^>]*+> # HTML tags\n | (?<raw>`+)([^`]|(?!(?<!`)\\k<raw>(?!`))`)*+\\k<raw>\n # Raw\n | \\\\[\\\\`*_{}\\[\\]()#.!+\\->]?+ # Escapes\n | \\[\n (\n (?<square> # Named group\n [^\\[\\]\\\\] # Match most chars\n | \\\\. # Escaped chars\n | \\[ \\g<square>*+ \\] # Nested brackets\n )*+\n \\]\n (\n ( # Reference Link\n [ ]? # Optional space\n \\[[^\\]]*+\\] # Ref name\n )\n | ( # Inline Link\n \\( # Opening paren\n [ \\t]*+ # Optional whitespace\n <?(.*?)>? # URL\n [ \\t]*+ # Optional whitespace\n ( # Optional Title\n (?<title>['\"])\n (.*?)\n \\k<title>\n )?\n \\)\n )\n )\n )\n | (?!(?<=\\S)\\1). # Everything besides\n # style closer\n )++\n (?<=\\S)(?=__\\b|\\*\\*)\\1 # Close\n)\n",
"captures": {
"1": {
"name": "punctuation.definition.bold.markdown"
@ -2569,5 +2567,3 @@
}
}
}
}
}

View file

@ -77,6 +77,16 @@
"meta.import string.quoted": "other",
"variable.other.jsdoc": "other"
}
},
{
"scopeName": "documentation.markdown.injection",
"path": "./syntaxes/MarkdownDocumentationInjection.tmLanguage.json",
"injectTo": [
"source.ts",
"source.tsx",
"source.js",
"source.js.jsx"
]
}
],
"snippets": [

View file

@ -0,0 +1,29 @@
{
"injectionSelector": "L:comment.block.documentation",
"patterns": [
{
"include": "#markdown-comment"
}
],
"repository": {
"markdown-comment": {
"begin": "^\\s*\\*(?!/)",
"while": "(^|\\G)\\s*\\*(?!/)",
"patterns": [
{
"include": "text.html.markdown#fenced_code_block"
},
{
"include": "text.html.markdown#lists"
},
{
"include": "source.ts#docblock"
},
{
"include": "text.html.markdown#inline"
}
]
}
},
"scopeName": "documentation.markdown.injection"
}