mirror of
https://github.com/Microsoft/vscode
synced 2024-08-28 05:19:39 +00:00
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
This commit is contained in:
parent
27903c28aa
commit
0d55d50173
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue