diff --git a/extensions/markdown-math/notebook/katex.ts b/extensions/markdown-math/notebook/katex.ts index f6b683ffcb6..ee68b15d61b 100644 --- a/extensions/markdown-math/notebook/katex.ts +++ b/extensions/markdown-math/notebook/katex.ts @@ -43,10 +43,12 @@ export async function activate(ctx: RendererContext) { document.head.appendChild(styleTemplate); const katex = require('@iktakahiro/markdown-it-katex'); + const macros = {}; markdownItRenderer.extendMarkdownIt((md: markdownIt.MarkdownIt) => { return md.use(katex, { globalGroup: true, enableBareBlocks: true, + macros }); }); } diff --git a/extensions/markdown-math/src/extension.ts b/extensions/markdown-math/src/extension.ts index 21a96970cbf..542a3ba154d 100644 --- a/extensions/markdown-math/src/extension.ts +++ b/extensions/markdown-math/src/extension.ts @@ -24,7 +24,9 @@ export function activate(context: vscode.ExtensionContext) { extendMarkdownIt(md: any) { if (isEnabled()) { const katex = require('@iktakahiro/markdown-it-katex'); - return md.use(katex, { globalGroup: true }); + const options = { globalGroup: true, macros: {} }; + md.core.ruler.push('reset-katex-macros', () => { options.macros = {}; }); + return md.use(katex, options); } return md; }