diff --git a/extensions/markdown-language-features/notebook/index.ts b/extensions/markdown-language-features/notebook/index.ts index e8c30c9b1eb..d89f9b15d80 100644 --- a/extensions/markdown-language-features/notebook/index.ts +++ b/extensions/markdown-language-features/notebook/index.ts @@ -342,7 +342,11 @@ export const activate: ActivationFunction = (ctx) => { } }, extendMarkdownIt: (f: (md: typeof markdownIt) => void) => { - f(markdownIt); + try { + f(markdownIt); + } catch (err) { + console.error('Error extending markdown-it', err); + } } }; }; diff --git a/extensions/markdown-math/notebook/katex.ts b/extensions/markdown-math/notebook/katex.ts index 92b2e5a56a7..94aad4f3c3b 100644 --- a/extensions/markdown-math/notebook/katex.ts +++ b/extensions/markdown-math/notebook/katex.ts @@ -45,7 +45,7 @@ export async function activate(ctx: RendererContext) { styleTemplate.content.appendChild(link); document.head.appendChild(styleTemplate); - const katex = require('@vscode/markdown-it-katex'); + const katex = require('@vscode/markdown-it-katex').default; const macros = {}; markdownItRenderer.extendMarkdownIt((md: markdownIt.MarkdownIt) => { return md.use(katex, { diff --git a/extensions/markdown-math/package.json b/extensions/markdown-math/package.json index ea2761b901d..8947e89ed2f 100644 --- a/extensions/markdown-math/package.json +++ b/extensions/markdown-math/package.json @@ -98,7 +98,7 @@ "build-notebook": "node ./esbuild" }, "dependencies": { - "@vscode/markdown-it-katex": "^1.0.1" + "@vscode/markdown-it-katex": "^1.0.2" }, "devDependencies": { "@types/markdown-it": "^0.0.0", diff --git a/extensions/markdown-math/src/extension.ts b/extensions/markdown-math/src/extension.ts index 38fe52b3203..1c27036b2fc 100644 --- a/extensions/markdown-math/src/extension.ts +++ b/extensions/markdown-math/src/extension.ts @@ -28,7 +28,7 @@ export function activate(context: vscode.ExtensionContext) { return { extendMarkdownIt(md: any) { if (isEnabled()) { - const katex = require('@vscode/markdown-it-katex'); + const katex = require('@vscode/markdown-it-katex').default; const settingsMacros = getMacros(); const options = { globalGroup: true, macros: { ...settingsMacros } }; md.core.ruler.push('reset-katex-macros', () => { diff --git a/extensions/markdown-math/yarn.lock b/extensions/markdown-math/yarn.lock index 3b6786c1c1d..e49c27e7bf8 100644 --- a/extensions/markdown-math/yarn.lock +++ b/extensions/markdown-math/yarn.lock @@ -12,10 +12,10 @@ resolved "https://registry.yarnpkg.com/@types/vscode-notebook-renderer/-/vscode-notebook-renderer-1.72.0.tgz#8943dc3cef0ced2dfb1e04c0a933bd289e7d5199" integrity sha512-5iTjb39DpLn03ULUwrDR3L2Dy59RV4blSUHy0oLdQuIY11PhgWO4mXIcoFS0VxY1GZQ4IcjSf3ooT2Jrrcahnw== -"@vscode/markdown-it-katex@^1.0.1": - version "1.0.1" - resolved "https://registry.yarnpkg.com/@vscode/markdown-it-katex/-/markdown-it-katex-1.0.1.tgz#79c6e7312074e1f897cc22c42ce078d1e72003b0" - integrity sha512-O/HiT5Uc6rN6rSx8tDdgwO1tLSn/lrNeikTzYw1EBG6B2IGLKw4I4e/GBh9DRNSdE9PajCA0tsVBz86qyA7B3A== +"@vscode/markdown-it-katex@^1.0.2": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@vscode/markdown-it-katex/-/markdown-it-katex-1.0.2.tgz#27ba579fa3896b2944b71209dd30d0f983983f11" + integrity sha512-QY/OnOHPTqc8tQoCoAjVblILX4yE6xGZHKODtiTKqA328OXra+lSpeJO5Ouo9AAvrs9AwcCLz6xvW3zwcsPBQg== dependencies: katex "^0.16.4"