Adds support for Github-style fenced math blocks in markdown editor and preview (#213750)
* added support for markdown fenced math blocks * original markdownEngine.ts * Add fenced math block rendering to markdown-math * Update dependencies * custom parser for fenced math blocks * custom parser for fenced math blocks * reverted changes to extension.ts * reverted all changes from prior implementations * proper fence grammar implementation for math --------- Co-authored-by: Matt Bierner <matb@microsoft.com>pull/221530/head
parent
6d7dc0072b
commit
a35380d6f0
|
@ -441,4 +441,4 @@ function normalizeHighlightLang(lang: string | undefined) {
|
|||
default:
|
||||
return lang;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -56,6 +56,16 @@
|
|||
"meta.embedded.math.markdown": "latex",
|
||||
"punctuation.definition.math.end.markdown": "latex"
|
||||
}
|
||||
},
|
||||
{
|
||||
"scopeName": "markdown.math.codeblock",
|
||||
"path": "./syntaxes/md-math-fence.tmLanguage.json",
|
||||
"injectTo": [
|
||||
"text.html.markdown"
|
||||
],
|
||||
"embeddedLanguages": {
|
||||
"meta.embedded.math.markdown": "latex"
|
||||
}
|
||||
}
|
||||
],
|
||||
"notebookRenderer": [
|
||||
|
|
|
@ -43,4 +43,4 @@ export function activate(context: vscode.ExtensionContext) {
|
|||
return md;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
|
@ -82,4 +82,4 @@
|
|||
}
|
||||
},
|
||||
"scopeName": "markdown.math.block"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"fileTypes": [],
|
||||
"injectionSelector": "L:markup.fenced_code.block.markdown",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#math-code-block"
|
||||
}
|
||||
],
|
||||
"repository": {
|
||||
"math-code-block": {
|
||||
"begin": "(?<=[`~])math(\\s+[^`~]*)?$",
|
||||
"end": "(^|\\G)(?=\\s*[`~]{3,}\\s*$)",
|
||||
"patterns": [
|
||||
{
|
||||
"begin": "(^|\\G)(\\s*)(.*)",
|
||||
"while": "(^|\\G)(?!\\s*([`~]{3,})\\s*$)",
|
||||
"contentName": "meta.embedded.math.markdown",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "text.html.markdown.math#math"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"scopeName": "markdown.math.codeblock"
|
||||
}
|
Loading…
Reference in New Issue