diff --git a/extensions/markdown-language-features/notebook/index.ts b/extensions/markdown-language-features/notebook/index.ts index 7324dab4e47..5255f277d9a 100644 --- a/extensions/markdown-language-features/notebook/index.ts +++ b/extensions/markdown-language-features/notebook/index.ts @@ -6,12 +6,13 @@ const MarkdownIt = require('markdown-it'); import * as DOMPurify from 'dompurify'; import type * as markdownIt from 'markdown-it'; +import type { RendererContext } from 'vscode-notebook-renderer'; const sanitizerOptions: DOMPurify.Config = { ALLOWED_TAGS: ['a', 'button', 'blockquote', 'code', 'div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'img', 'input', 'label', 'li', 'p', 'pre', 'select', 'small', 'span', 'strong', 'textarea', 'ul', 'ol'], }; -export function activate(ctx: { workspace: { isTrusted: boolean } }) { +export function activate(ctx: RendererContext) { let markdownIt = new MarkdownIt({ html: true }); diff --git a/extensions/markdown-language-features/package.json b/extensions/markdown-language-features/package.json index 6f47f8a6f7e..8aa82663449 100644 --- a/extensions/markdown-language-features/package.json +++ b/extensions/markdown-language-features/package.json @@ -364,6 +364,7 @@ "@types/highlight.js": "10.1.0", "@types/lodash.throttle": "^4.1.3", "@types/markdown-it": "0.0.2", + "@types/vscode-notebook-renderer": "^1.60.0", "@types/vscode-webview": "^1.57.0", "lodash.throttle": "^4.1.1" }, diff --git a/extensions/markdown-language-features/yarn.lock b/extensions/markdown-language-features/yarn.lock index 8b9c867ee1d..e2e15d071bf 100644 --- a/extensions/markdown-language-features/yarn.lock +++ b/extensions/markdown-language-features/yarn.lock @@ -38,6 +38,11 @@ resolved "https://registry.yarnpkg.com/@types/trusted-types/-/trusted-types-2.0.2.tgz#fc25ad9943bcac11cceb8168db4f275e0e72e756" integrity sha512-F5DIZ36YVLE+PN+Zwws4kJogq47hNgX3Nx6WyDJ3kcplxyke3XIzB8uK5n/Lpm1HBsbGzd6nmGehL8cPekP+Tg== +"@types/vscode-notebook-renderer@^1.60.0": + version "1.60.0" + resolved "https://registry.yarnpkg.com/@types/vscode-notebook-renderer/-/vscode-notebook-renderer-1.60.0.tgz#8a67d561f48ddf46a95dfa9f712a79c72c7b8f7a" + integrity sha512-u7TD2uuEZTVuitx0iijOJdKI0JLiQP6PsSBSRy2XmHXUOXcp5p1S56NrjOEDoF+PIHd3NL3eO6KTRSf5nukDqQ== + "@types/vscode-webview@^1.57.0": version "1.57.0" resolved "https://registry.yarnpkg.com/@types/vscode-webview/-/vscode-webview-1.57.0.tgz#bad5194d45ae8d03afc1c0f67f71ff5e7a243bbf" diff --git a/extensions/markdown-math/notebook/katex.ts b/extensions/markdown-math/notebook/katex.ts index 292551e4a3f..cc076db5201 100644 --- a/extensions/markdown-math/notebook/katex.ts +++ b/extensions/markdown-math/notebook/katex.ts @@ -3,13 +3,12 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import type * as markdownIt from 'markdown-it'; +import type { RendererContext } from 'vscode-notebook-renderer'; const styleHref = import.meta.url.replace(/katex.js$/, 'katex.min.css'); -export async function activate(ctx: { - getRenderer: (id: string) => Promise -}) { - const markdownItRenderer = await ctx.getRenderer('markdownItRenderer'); +export async function activate(ctx: RendererContext) { + const markdownItRenderer = (await ctx.getRenderer('markdownItRenderer')) as undefined | any; if (!markdownItRenderer) { throw new Error('Could not load markdownItRenderer'); } diff --git a/extensions/markdown-math/package.json b/extensions/markdown-math/package.json index 7d0b42cddc2..5a4dbe3080b 100644 --- a/extensions/markdown-math/package.json +++ b/extensions/markdown-math/package.json @@ -94,7 +94,8 @@ "@iktakahiro/markdown-it-katex": "https://github.com/mjbvz/markdown-it-katex.git" }, "devDependencies": { - "@types/markdown-it": "^0.0.0" + "@types/markdown-it": "^0.0.0", + "@types/vscode-notebook-renderer": "^1.60.0" }, "repository": { "type": "git", diff --git a/extensions/markdown-math/yarn.lock b/extensions/markdown-math/yarn.lock index f402ca890b7..ac52779ca6e 100644 --- a/extensions/markdown-math/yarn.lock +++ b/extensions/markdown-math/yarn.lock @@ -13,6 +13,11 @@ resolved "https://registry.yarnpkg.com/@types/markdown-it/-/markdown-it-0.0.0.tgz#8f6acaa5e3245e275f684e95deb3e518d1c6ab16" integrity sha1-j2rKpeMkXidfaE6V3rPlGNHGqxY= +"@types/vscode-notebook-renderer@^1.60.0": + version "1.60.0" + resolved "https://registry.yarnpkg.com/@types/vscode-notebook-renderer/-/vscode-notebook-renderer-1.60.0.tgz#8a67d561f48ddf46a95dfa9f712a79c72c7b8f7a" + integrity sha512-u7TD2uuEZTVuitx0iijOJdKI0JLiQP6PsSBSRy2XmHXUOXcp5p1S56NrjOEDoF+PIHd3NL3eO6KTRSf5nukDqQ== + commander@^6.0.0: version "6.2.1" resolved "https://registry.yarnpkg.com/commander/-/commander-6.2.1.tgz#0792eb682dfbc325999bb2b84fddddba110ac73c"