diff options
author | Matt Bierner <matb@microsoft.com> | 2022-05-19 02:14:32 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-19 02:14:32 +0300 |
commit | 0d55d5017316ebe7c799b86cea03fc9d26687b7f (patch) | |
tree | 86747e15ed15d1042451c0522d7d9cefb6f43a2b /extensions | |
parent | 27903c28aa767fec440eeed72826af79152bb3b4 (diff) |
Expose outputItem in notebook markdown eve (#149870)
For #121256
This change adds the current `ouputItem` to the notebook markdown renderer's environment
Renders that extend our markdown renderer can use this to access output item metadata for example
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/markdown-language-features/notebook/index.ts | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/extensions/markdown-language-features/notebook/index.ts b/extensions/markdown-language-features/notebook/index.ts index 3fdb86bd8d7..079ed928f3f 100644 --- a/extensions/markdown-language-features/notebook/index.ts +++ b/extensions/markdown-language-features/notebook/index.ts @@ -207,7 +207,9 @@ export const activate: ActivationFunction<void> = (ctx) => { previewNode.classList.remove('emptyMarkdownCell'); const markdownText = outputInfo.mime.startsWith('text/x-') ? `\`\`\`${outputInfo.mime.substr(7)}\n${text}\n\`\`\`` : (outputInfo.mime.startsWith('application/') ? `\`\`\`${outputInfo.mime.substr(12)}\n${text}\n\`\`\`` : text); - const unsanitizedRenderedMarkdown = markdownIt.render(markdownText); + const unsanitizedRenderedMarkdown = markdownIt.render(markdownText, { + outputItem: outputInfo, + }); previewNode.innerHTML = (ctx.workspace.isTrusted ? unsanitizedRenderedMarkdown : DOMPurify.sanitize(unsanitizedRenderedMarkdown, sanitizerOptions)) as string; |