mirror of
https://github.com/Microsoft/vscode
synced 2024-10-12 06:17:18 +00:00
okay now things are actually fresh and working
This commit is contained in:
parent
4d215cb441
commit
0fa857c9a1
247
extensions/ipynb/package-lock.json
generated
Normal file
247
extensions/ipynb/package-lock.json
generated
Normal file
|
@ -0,0 +1,247 @@
|
|||
{
|
||||
"name": "ipynb",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "ipynb",
|
||||
"version": "1.0.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@enonic/fnv-plus": "^1.3.0",
|
||||
"detect-indent": "^6.0.0",
|
||||
"markdown-it": "^12.3.2",
|
||||
"uuid": "^8.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@jupyterlab/nbformat": "^3.2.9",
|
||||
"@types/markdown-it": "12.2.3",
|
||||
"@types/uuid": "^8.3.1"
|
||||
},
|
||||
"engines": {
|
||||
"vscode": "^1.57.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@enonic/fnv-plus": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@enonic/fnv-plus/-/fnv-plus-1.3.0.tgz",
|
||||
"integrity": "sha512-BCN9uNWH8AmiP7BXBJqEinUY9KXalmRzo+L0cB/mQsmFfzODxwQrbvxCHXUNH2iP+qKkWYtB4vyy8N62PViMFw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@jupyterlab/nbformat": {
|
||||
"version": "3.2.9",
|
||||
"resolved": "https://registry.npmjs.org/@jupyterlab/nbformat/-/nbformat-3.2.9.tgz",
|
||||
"integrity": "sha512-WSf9OQo8yfFjyodbXRdFoaNwMkaAL5jFZiD6V2f8HqI380ipansWrrV7R9CGzPfgKHpUGZMO1tYKmUwzMhvZ4w==",
|
||||
"dev": true,
|
||||
"license": "BSD-3-Clause",
|
||||
"dependencies": {
|
||||
"@lumino/coreutils": "^1.5.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@lumino/coreutils": {
|
||||
"version": "1.12.0",
|
||||
"resolved": "https://registry.npmjs.org/@lumino/coreutils/-/coreutils-1.12.0.tgz",
|
||||
"integrity": "sha512-DSglh4ylmLi820CNx9soJmDJCpUgymckdWeGWuN0Ash5g60oQvrQDfosVxEhzmNvtvXv45WZEqSBzDP6E5SEmQ==",
|
||||
"dev": true,
|
||||
"license": "BSD-3-Clause",
|
||||
"peerDependencies": {
|
||||
"crypto": "1.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/linkify-it": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/linkify-it/-/linkify-it-3.0.2.tgz",
|
||||
"integrity": "sha512-HZQYqbiFVWufzCwexrvh694SOim8z2d+xJl5UNamcvQFejLY/2YUtzXHYi3cHdI7PMlS8ejH2slRAOJQ32aNbA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/markdown-it": {
|
||||
"version": "12.2.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/markdown-it/-/markdown-it-12.2.3.tgz",
|
||||
"integrity": "sha512-GKMHFfv3458yYy+v/N8gjufHO6MSZKCOXpZc5GXIWWy8uldwfmPn98vp81gZ5f9SVw8YYBctgfJ22a2d7AOMeQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/linkify-it": "*",
|
||||
"@types/mdurl": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/mdurl": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/mdurl/-/mdurl-1.0.2.tgz",
|
||||
"integrity": "sha512-eC4U9MlIcu2q0KQmXszyn5Akca/0jrQmwDRgpAMJai7qBWq4amIQhZyNau4VYGtCeALvW1/NtjzJJ567aZxfKA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/uuid": {
|
||||
"version": "8.3.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-8.3.1.tgz",
|
||||
"integrity": "sha512-Y2mHTRAbqfFkpjldbkHGY8JIzRN6XqYRliG8/24FcHm2D2PwW24fl5xMRTVGdrb7iMrwCaIEbLWerGIkXuFWVg==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/argparse": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
|
||||
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="
|
||||
},
|
||||
"node_modules/detect-indent": {
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-6.1.0.tgz",
|
||||
"integrity": "sha512-reYkTUJAZb9gUuZ2RvVCNhVHdg62RHnJ7WJl8ftMi4diZ6NWlciOzQN88pUhSELEwflJht4oQDv0F0BMlwaYtA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/entities": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/entities/-/entities-2.1.0.tgz",
|
||||
"integrity": "sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w==",
|
||||
"funding": {
|
||||
"url": "https://github.com/fb55/entities?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/linkify-it": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-3.0.3.tgz",
|
||||
"integrity": "sha512-ynTsyrFSdE5oZ/O9GEf00kPngmOfVwazR5GKDq6EYfhlpFug3J2zybX56a2PRRpc9P+FuSoGNAwjlbDs9jJBPQ==",
|
||||
"dependencies": {
|
||||
"uc.micro": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/markdown-it": {
|
||||
"version": "12.3.2",
|
||||
"resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-12.3.2.tgz",
|
||||
"integrity": "sha512-TchMembfxfNVpHkbtriWltGWc+m3xszaRD0CZup7GFFhzIgQqxIfn3eGj1yZpfuflzPvfkt611B2Q/Bsk1YnGg==",
|
||||
"dependencies": {
|
||||
"argparse": "^2.0.1",
|
||||
"entities": "~2.1.0",
|
||||
"linkify-it": "^3.0.1",
|
||||
"mdurl": "^1.0.1",
|
||||
"uc.micro": "^1.0.5"
|
||||
},
|
||||
"bin": {
|
||||
"markdown-it": "bin/markdown-it.js"
|
||||
}
|
||||
},
|
||||
"node_modules/mdurl": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz",
|
||||
"integrity": "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g=="
|
||||
},
|
||||
"node_modules/uc.micro": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz",
|
||||
"integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA=="
|
||||
},
|
||||
"node_modules/uuid": {
|
||||
"version": "8.3.2",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
|
||||
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"uuid": "dist/bin/uuid"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@enonic/fnv-plus": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@enonic/fnv-plus/-/fnv-plus-1.3.0.tgz",
|
||||
"integrity": "sha512-BCN9uNWH8AmiP7BXBJqEinUY9KXalmRzo+L0cB/mQsmFfzODxwQrbvxCHXUNH2iP+qKkWYtB4vyy8N62PViMFw=="
|
||||
},
|
||||
"@jupyterlab/nbformat": {
|
||||
"version": "3.2.9",
|
||||
"resolved": "https://registry.npmjs.org/@jupyterlab/nbformat/-/nbformat-3.2.9.tgz",
|
||||
"integrity": "sha512-WSf9OQo8yfFjyodbXRdFoaNwMkaAL5jFZiD6V2f8HqI380ipansWrrV7R9CGzPfgKHpUGZMO1tYKmUwzMhvZ4w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@lumino/coreutils": "^1.5.3"
|
||||
}
|
||||
},
|
||||
"@lumino/coreutils": {
|
||||
"version": "1.12.0",
|
||||
"resolved": "https://registry.npmjs.org/@lumino/coreutils/-/coreutils-1.12.0.tgz",
|
||||
"integrity": "sha512-DSglh4ylmLi820CNx9soJmDJCpUgymckdWeGWuN0Ash5g60oQvrQDfosVxEhzmNvtvXv45WZEqSBzDP6E5SEmQ==",
|
||||
"dev": true,
|
||||
"requires": {}
|
||||
},
|
||||
"@types/linkify-it": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/linkify-it/-/linkify-it-3.0.2.tgz",
|
||||
"integrity": "sha512-HZQYqbiFVWufzCwexrvh694SOim8z2d+xJl5UNamcvQFejLY/2YUtzXHYi3cHdI7PMlS8ejH2slRAOJQ32aNbA==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/markdown-it": {
|
||||
"version": "12.2.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/markdown-it/-/markdown-it-12.2.3.tgz",
|
||||
"integrity": "sha512-GKMHFfv3458yYy+v/N8gjufHO6MSZKCOXpZc5GXIWWy8uldwfmPn98vp81gZ5f9SVw8YYBctgfJ22a2d7AOMeQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/linkify-it": "*",
|
||||
"@types/mdurl": "*"
|
||||
}
|
||||
},
|
||||
"@types/mdurl": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/mdurl/-/mdurl-1.0.2.tgz",
|
||||
"integrity": "sha512-eC4U9MlIcu2q0KQmXszyn5Akca/0jrQmwDRgpAMJai7qBWq4amIQhZyNau4VYGtCeALvW1/NtjzJJ567aZxfKA==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/uuid": {
|
||||
"version": "8.3.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-8.3.1.tgz",
|
||||
"integrity": "sha512-Y2mHTRAbqfFkpjldbkHGY8JIzRN6XqYRliG8/24FcHm2D2PwW24fl5xMRTVGdrb7iMrwCaIEbLWerGIkXuFWVg==",
|
||||
"dev": true
|
||||
},
|
||||
"argparse": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
|
||||
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="
|
||||
},
|
||||
"detect-indent": {
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-6.1.0.tgz",
|
||||
"integrity": "sha512-reYkTUJAZb9gUuZ2RvVCNhVHdg62RHnJ7WJl8ftMi4diZ6NWlciOzQN88pUhSELEwflJht4oQDv0F0BMlwaYtA=="
|
||||
},
|
||||
"entities": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/entities/-/entities-2.1.0.tgz",
|
||||
"integrity": "sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w=="
|
||||
},
|
||||
"linkify-it": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-3.0.3.tgz",
|
||||
"integrity": "sha512-ynTsyrFSdE5oZ/O9GEf00kPngmOfVwazR5GKDq6EYfhlpFug3J2zybX56a2PRRpc9P+FuSoGNAwjlbDs9jJBPQ==",
|
||||
"requires": {
|
||||
"uc.micro": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"markdown-it": {
|
||||
"version": "12.3.2",
|
||||
"resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-12.3.2.tgz",
|
||||
"integrity": "sha512-TchMembfxfNVpHkbtriWltGWc+m3xszaRD0CZup7GFFhzIgQqxIfn3eGj1yZpfuflzPvfkt611B2Q/Bsk1YnGg==",
|
||||
"requires": {
|
||||
"argparse": "^2.0.1",
|
||||
"entities": "~2.1.0",
|
||||
"linkify-it": "^3.0.1",
|
||||
"mdurl": "^1.0.1",
|
||||
"uc.micro": "^1.0.5"
|
||||
}
|
||||
},
|
||||
"mdurl": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz",
|
||||
"integrity": "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g=="
|
||||
},
|
||||
"uc.micro": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz",
|
||||
"integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA=="
|
||||
},
|
||||
"uuid": {
|
||||
"version": "8.3.2",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
|
||||
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="
|
||||
}
|
||||
}
|
||||
}
|
|
@ -70,16 +70,19 @@
|
|||
}
|
||||
},
|
||||
"scripts": {
|
||||
"compile": "npx gulp compile-extension:ipynb",
|
||||
"watch": "npx gulp watch-extension:ipynb"
|
||||
"compile": "npx gulp compile-extension:ipynb && npm run build-notebook",
|
||||
"watch": "npx gulp watch-extension:ipynb",
|
||||
"build-notebook": "node ./esbuild"
|
||||
},
|
||||
"dependencies": {
|
||||
"@enonic/fnv-plus": "^1.3.0",
|
||||
"detect-indent": "^6.0.0",
|
||||
"markdown-it": "^12.3.2",
|
||||
"uuid": "^8.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@jupyterlab/nbformat": "^3.2.9",
|
||||
"@types/markdown-it": "12.2.3",
|
||||
"@types/uuid": "^8.3.1"
|
||||
},
|
||||
"repository": {
|
||||
|
|
149
extensions/ipynb/src/cellAttachmentRenderer.ts
Normal file
149
extensions/ipynb/src/cellAttachmentRenderer.ts
Normal file
|
@ -0,0 +1,149 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import type * as MarkdownIt from 'markdown-it';
|
||||
// import type * as MarkdownItToken from 'markdown-it/lib/token';
|
||||
import type { RendererContext } from 'vscode-notebook-renderer';
|
||||
|
||||
interface MarkdownItRenderer {
|
||||
extendMarkdownIt(fn: (md: MarkdownIt) => void): void;
|
||||
}
|
||||
|
||||
export async function activate(ctx: RendererContext<void>) {
|
||||
console.log('CellAttachmentRenderer activation');
|
||||
const markdownItRenderer = (await ctx.getRenderer('vscode.markdown-it-renderer')) as MarkdownItRenderer | any;
|
||||
if (!markdownItRenderer) {
|
||||
throw new Error(`Could not load 'vscode.markdown-it-renderer'`);
|
||||
}
|
||||
markdownItRenderer.extendMarkdownIt((md: MarkdownIt) => {
|
||||
// addCellAttachmentRendering(md);
|
||||
// const originalRender = md.render;
|
||||
|
||||
md.renderInline = function () {
|
||||
const outputInfo = arguments[1].outputItem;
|
||||
|
||||
|
||||
const text = outputInfo.text();
|
||||
let 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 attachments: Record<string, Record<string, string>> = (outputInfo.metadata as any).custom.attachments;
|
||||
if (attachments) {
|
||||
let attachmentName: keyof typeof attachments;
|
||||
for (attachmentName in attachments) {
|
||||
const [attachmentKey, attachmentVal] = Object.entries(attachments[attachmentName])[0];
|
||||
const attachmentData = 'data:' + attachmentKey + ';base64,' + attachmentVal;
|
||||
markdownText = markdownText.replace(`attachment:${attachmentName}`, attachmentData);
|
||||
}
|
||||
}
|
||||
// const unsanitizedRenderedMarkdown =
|
||||
return markdownText;
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
// function addCellAttachmentRendering(md: MarkdownIt): void {
|
||||
// console.log('cell render fxn');
|
||||
// const cell_attachment = md.renderer.rules.cell_attachment;
|
||||
// md.renderer.rules.cell_attachment = (tokens: MarkdownItToken[], idx: number, options, env, self) => {
|
||||
// // const token = tokens[idx];
|
||||
// console.log('rule fxn');
|
||||
// const outputInfo = env.outputItem;
|
||||
// const text = outputInfo.text();
|
||||
// let 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 attachments: Record<string, Record<string, string>> = (outputInfo.metadata as any).custom.attachments;
|
||||
// if (attachments) {
|
||||
// let attachmentName: keyof typeof attachments;
|
||||
// for (attachmentName in attachments) {
|
||||
// const [attachmentKey, attachmentVal] = Object.entries(attachments[attachmentName])[0];
|
||||
// const attachmentData = 'data:' + attachmentKey + ';base64,' + attachmentVal;
|
||||
// markdownText = markdownText.replace(`attachment:${attachmentName}`, attachmentData);
|
||||
// }
|
||||
// }
|
||||
// // const unsanitizedRenderedMarkdown =
|
||||
// return md.render(markdownText, { outputItem: outputInfo, });
|
||||
// // return self.renderToken(tokens, idx, options);
|
||||
// };
|
||||
|
||||
// const originalRender = md.render;
|
||||
// md.render = function () {
|
||||
// return originalRender.apply(this, arguments as any);
|
||||
// };
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// md.renderer.rules.attachmentRender = (tokens: MarkdownItToken[], idx: number, options, env, self) => {
|
||||
// console.log('rule fxn');
|
||||
// const outputInfo = env.outputItem;
|
||||
// const text = outputInfo.text();
|
||||
// let 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 attachments: Record<string, Record<string, string>> = (outputInfo.metadata as any).custom.attachments;
|
||||
// if (attachments) {
|
||||
// let attachmentName: keyof typeof attachments;
|
||||
// for (attachmentName in attachments) {
|
||||
// const [attachmentKey, attachmentVal] = Object.entries(attachments[attachmentName])[0];
|
||||
// const attachmentData = 'data:' + attachmentKey + ';base64,' + attachmentVal;
|
||||
// markdownText = markdownText.replace(`attachment:${attachmentName}`, attachmentData);
|
||||
// }
|
||||
// }
|
||||
// // const unsanitizedRenderedMarkdown =
|
||||
// const unsanitizedRenderedMarkdown = md.render(markdownText, { outputItem: outputInfo, });
|
||||
|
||||
|
||||
// return self.renderToken(tokens, idx, options);
|
||||
// };
|
||||
|
||||
// const originalRender = md.render;
|
||||
// md.render = function () {
|
||||
// return originalRender.apply(this, arguments as any);
|
||||
// };
|
||||
|
||||
|
||||
// FIXME: kinda works. data is there at least
|
||||
// function addCellAttachmentRendering(md: MarkdownIt): void {
|
||||
// console.log('cell render fxn');
|
||||
// md.renderer.rules.attachmentRender = (tokens: MarkdownItToken[], idx: number, options, env, self) => {
|
||||
// console.log('rule fxn');
|
||||
// const outputInfo = env.outputItem;
|
||||
// const text = outputInfo.text();
|
||||
// let 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 attachments: Record<string, Record<string, string>> = (outputInfo.metadata as any).custom.attachments;
|
||||
// if (attachments) {
|
||||
// let attachmentName: keyof typeof attachments;
|
||||
// for (attachmentName in attachments) {
|
||||
// const [attachmentKey, attachmentVal] = Object.entries(attachments[attachmentName])[0];
|
||||
// const attachmentData = 'data:' + attachmentKey + ';base64,' + attachmentVal;
|
||||
// markdownText = markdownText.replace(`attachment:${attachmentName}`, attachmentData);
|
||||
// }
|
||||
// }
|
||||
// // const unsanitizedRenderedMarkdown =
|
||||
// const unsanitizedRenderedMarkdown = md.render(markdownText, { outputItem: outputInfo, });
|
||||
|
||||
|
||||
// return self.renderToken(tokens, idx, options);
|
||||
// };
|
||||
|
||||
// const originalRender = md.render;
|
||||
// md.render = function () {
|
||||
// return originalRender.apply(this, arguments as any);
|
||||
// };
|
||||
// }
|
||||
|
||||
|
||||
// implement code below to render cell attachments
|
||||
// fIXME: metadata needs typing other than 'unknonw', rather than cast as any
|
||||
// tODO: put attachments field as top level, instead of metadata->custom->attachments (match jupyter) ??? Maybe -- meeting
|
||||
// const attachments = outputInfo.metadata.custom.attachments; // fIXME: might be messy, but I put a field "custom" within the NotebookCellMetadata interface. meeting with Peng/Matt to decide how to handle this
|
||||
// const attachments: Record<string, Record<string, string>> = (outputInfo.metadata as any).custom.attachments;
|
||||
// if (attachments) {
|
||||
// let attachmentName: keyof typeof attachments;
|
||||
// for (attachmentName in attachments) {
|
||||
// const [attachmentKey, attachmentVal] = Object.entries(attachments[attachmentName])[0];
|
||||
// const attachmentData = 'data:' + attachmentKey + ';base64,' + attachmentVal;
|
||||
// markdownText = markdownText.replace(`attachment:${attachmentName}`, attachmentData);
|
||||
// }
|
||||
// }
|
|
@ -3,33 +3,89 @@
|
|||
|
||||
|
||||
"@enonic/fnv-plus@^1.3.0":
|
||||
version "1.3.0"
|
||||
resolved "https://registry.yarnpkg.com/@enonic/fnv-plus/-/fnv-plus-1.3.0.tgz#be65a7b128a3b544f60aea3ef978d938e85869f3"
|
||||
integrity sha512-BCN9uNWH8AmiP7BXBJqEinUY9KXalmRzo+L0cB/mQsmFfzODxwQrbvxCHXUNH2iP+qKkWYtB4vyy8N62PViMFw==
|
||||
"integrity" "sha512-BCN9uNWH8AmiP7BXBJqEinUY9KXalmRzo+L0cB/mQsmFfzODxwQrbvxCHXUNH2iP+qKkWYtB4vyy8N62PViMFw=="
|
||||
"resolved" "https://registry.npmjs.org/@enonic/fnv-plus/-/fnv-plus-1.3.0.tgz"
|
||||
"version" "1.3.0"
|
||||
|
||||
"@jupyterlab/nbformat@^3.2.9":
|
||||
version "3.2.9"
|
||||
resolved "https://registry.yarnpkg.com/@jupyterlab/nbformat/-/nbformat-3.2.9.tgz#e7d854719612133498af4280d9a8caa0873205b0"
|
||||
integrity sha512-WSf9OQo8yfFjyodbXRdFoaNwMkaAL5jFZiD6V2f8HqI380ipansWrrV7R9CGzPfgKHpUGZMO1tYKmUwzMhvZ4w==
|
||||
"integrity" "sha512-WSf9OQo8yfFjyodbXRdFoaNwMkaAL5jFZiD6V2f8HqI380ipansWrrV7R9CGzPfgKHpUGZMO1tYKmUwzMhvZ4w=="
|
||||
"resolved" "https://registry.npmjs.org/@jupyterlab/nbformat/-/nbformat-3.2.9.tgz"
|
||||
"version" "3.2.9"
|
||||
dependencies:
|
||||
"@lumino/coreutils" "^1.5.3"
|
||||
|
||||
"@lumino/coreutils@^1.5.3":
|
||||
version "1.12.0"
|
||||
resolved "https://registry.yarnpkg.com/@lumino/coreutils/-/coreutils-1.12.0.tgz#fbdef760f736eaf2bd396a5c6fc3a68a4b449b15"
|
||||
integrity sha512-DSglh4ylmLi820CNx9soJmDJCpUgymckdWeGWuN0Ash5g60oQvrQDfosVxEhzmNvtvXv45WZEqSBzDP6E5SEmQ==
|
||||
"integrity" "sha512-DSglh4ylmLi820CNx9soJmDJCpUgymckdWeGWuN0Ash5g60oQvrQDfosVxEhzmNvtvXv45WZEqSBzDP6E5SEmQ=="
|
||||
"resolved" "https://registry.npmjs.org/@lumino/coreutils/-/coreutils-1.12.0.tgz"
|
||||
"version" "1.12.0"
|
||||
|
||||
"@types/linkify-it@*":
|
||||
"integrity" "sha512-HZQYqbiFVWufzCwexrvh694SOim8z2d+xJl5UNamcvQFejLY/2YUtzXHYi3cHdI7PMlS8ejH2slRAOJQ32aNbA=="
|
||||
"resolved" "https://registry.npmjs.org/@types/linkify-it/-/linkify-it-3.0.2.tgz"
|
||||
"version" "3.0.2"
|
||||
|
||||
"@types/markdown-it@12.2.3":
|
||||
"integrity" "sha512-GKMHFfv3458yYy+v/N8gjufHO6MSZKCOXpZc5GXIWWy8uldwfmPn98vp81gZ5f9SVw8YYBctgfJ22a2d7AOMeQ=="
|
||||
"resolved" "https://registry.npmjs.org/@types/markdown-it/-/markdown-it-12.2.3.tgz"
|
||||
"version" "12.2.3"
|
||||
dependencies:
|
||||
"@types/linkify-it" "*"
|
||||
"@types/mdurl" "*"
|
||||
|
||||
"@types/mdurl@*":
|
||||
"integrity" "sha512-eC4U9MlIcu2q0KQmXszyn5Akca/0jrQmwDRgpAMJai7qBWq4amIQhZyNau4VYGtCeALvW1/NtjzJJ567aZxfKA=="
|
||||
"resolved" "https://registry.npmjs.org/@types/mdurl/-/mdurl-1.0.2.tgz"
|
||||
"version" "1.0.2"
|
||||
|
||||
"@types/uuid@^8.3.1":
|
||||
version "8.3.1"
|
||||
resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-8.3.1.tgz#1a32969cf8f0364b3d8c8af9cc3555b7805df14f"
|
||||
integrity sha512-Y2mHTRAbqfFkpjldbkHGY8JIzRN6XqYRliG8/24FcHm2D2PwW24fl5xMRTVGdrb7iMrwCaIEbLWerGIkXuFWVg==
|
||||
"integrity" "sha512-Y2mHTRAbqfFkpjldbkHGY8JIzRN6XqYRliG8/24FcHm2D2PwW24fl5xMRTVGdrb7iMrwCaIEbLWerGIkXuFWVg=="
|
||||
"resolved" "https://registry.npmjs.org/@types/uuid/-/uuid-8.3.1.tgz"
|
||||
"version" "8.3.1"
|
||||
|
||||
detect-indent@^6.0.0:
|
||||
version "6.1.0"
|
||||
resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-6.1.0.tgz#592485ebbbf6b3b1ab2be175c8393d04ca0d57e6"
|
||||
integrity sha512-reYkTUJAZb9gUuZ2RvVCNhVHdg62RHnJ7WJl8ftMi4diZ6NWlciOzQN88pUhSELEwflJht4oQDv0F0BMlwaYtA==
|
||||
"argparse@^2.0.1":
|
||||
"integrity" "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="
|
||||
"resolved" "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz"
|
||||
"version" "2.0.1"
|
||||
|
||||
uuid@^8.3.2:
|
||||
version "8.3.2"
|
||||
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2"
|
||||
integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==
|
||||
"detect-indent@^6.0.0":
|
||||
"integrity" "sha512-reYkTUJAZb9gUuZ2RvVCNhVHdg62RHnJ7WJl8ftMi4diZ6NWlciOzQN88pUhSELEwflJht4oQDv0F0BMlwaYtA=="
|
||||
"resolved" "https://registry.npmjs.org/detect-indent/-/detect-indent-6.1.0.tgz"
|
||||
"version" "6.1.0"
|
||||
|
||||
"entities@~2.1.0":
|
||||
"integrity" "sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w=="
|
||||
"resolved" "https://registry.npmjs.org/entities/-/entities-2.1.0.tgz"
|
||||
"version" "2.1.0"
|
||||
|
||||
"linkify-it@^3.0.1":
|
||||
"integrity" "sha512-ynTsyrFSdE5oZ/O9GEf00kPngmOfVwazR5GKDq6EYfhlpFug3J2zybX56a2PRRpc9P+FuSoGNAwjlbDs9jJBPQ=="
|
||||
"resolved" "https://registry.npmjs.org/linkify-it/-/linkify-it-3.0.3.tgz"
|
||||
"version" "3.0.3"
|
||||
dependencies:
|
||||
"uc.micro" "^1.0.1"
|
||||
|
||||
"markdown-it@^12.3.2":
|
||||
"integrity" "sha512-TchMembfxfNVpHkbtriWltGWc+m3xszaRD0CZup7GFFhzIgQqxIfn3eGj1yZpfuflzPvfkt611B2Q/Bsk1YnGg=="
|
||||
"resolved" "https://registry.npmjs.org/markdown-it/-/markdown-it-12.3.2.tgz"
|
||||
"version" "12.3.2"
|
||||
dependencies:
|
||||
"argparse" "^2.0.1"
|
||||
"entities" "~2.1.0"
|
||||
"linkify-it" "^3.0.1"
|
||||
"mdurl" "^1.0.1"
|
||||
"uc.micro" "^1.0.5"
|
||||
|
||||
"mdurl@^1.0.1":
|
||||
"integrity" "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g=="
|
||||
"resolved" "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz"
|
||||
"version" "1.0.1"
|
||||
|
||||
"uc.micro@^1.0.1", "uc.micro@^1.0.5":
|
||||
"integrity" "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA=="
|
||||
"resolved" "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz"
|
||||
"version" "1.0.6"
|
||||
|
||||
"uuid@^8.3.2":
|
||||
"integrity" "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="
|
||||
"resolved" "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz"
|
||||
"version" "8.3.2"
|
||||
|
|
Loading…
Reference in a new issue