init tool
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
# Jupyter for Visual Studio Code
|
||||
|
||||
**Notice:** This extension is bundled with Visual Studio Code. It can be disabled but not uninstalled.
|
||||
|
||||
## Features
|
||||
|
||||
This extension provides the following Jupyter-related features for VS Code:
|
||||
|
||||
- Open, edit and save .ipynb files
|
||||
File diff suppressed because one or more lines are too long
+34
@@ -0,0 +1,34 @@
|
||||
// extensions/ipynb/notebook-src/cellAttachmentRenderer.ts
|
||||
async function activate(ctx) {
|
||||
const markdownItRenderer = await ctx.getRenderer("vscode.markdown-it-renderer");
|
||||
if (!markdownItRenderer) {
|
||||
throw new Error(`Could not load 'vscode.markdown-it-renderer'`);
|
||||
}
|
||||
markdownItRenderer.extendMarkdownIt((md) => {
|
||||
const original = md.renderer.rules.image;
|
||||
md.renderer.rules.image = (tokens, idx, options, env, self) => {
|
||||
const token = tokens[idx];
|
||||
const src = token.attrGet("src");
|
||||
const attachments = env.outputItem.metadata.attachments;
|
||||
if (attachments && src) {
|
||||
const imageAttachment = attachments[src.replace("attachment:", "")];
|
||||
if (imageAttachment) {
|
||||
const objEntries = Object.entries(imageAttachment);
|
||||
if (objEntries.length) {
|
||||
const [attachmentKey, attachmentVal] = objEntries[0];
|
||||
const b64Markdown = "data:" + attachmentKey + ";base64," + attachmentVal;
|
||||
token.attrSet("src", b64Markdown);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (original) {
|
||||
return original(tokens, idx, options, env, self);
|
||||
} else {
|
||||
return self.renderToken(tokens, idx, options);
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
export {
|
||||
activate
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"ipynb","displayName":"%displayName%","description":"%description%","publisher":"vscode","version":"1.0.0","license":"MIT","engines":{"vscode":"^1.57.0"},"enabledApiProposals":["documentPaste","diffContentOptions"],"activationEvents":["onNotebook:jupyter-notebook","onCommand:ipynb.newUntitledIpynb"],"extensionKind":["workspace","ui"],"main":"./dist/ipynbMain.js","browser":"./dist/browser/ipynbMain.js","capabilities":{"virtualWorkspaces":true,"untrustedWorkspaces":{"supported":true}},"contributes":{"configuration":[{"properties":{"ipynb.pasteImagesAsAttachments.enabled":{"type":"boolean","scope":"resource","markdownDescription":"%ipynb.pasteImagesAsAttachments.enabled%","default":true}}}],"commands":[{"command":"ipynb.newUntitledIpynb","title":"New Jupyter Notebook","shortTitle":"Jupyter Notebook","category":"Create"},{"command":"ipynb.openIpynbInNotebookEditor","title":"Open ipynb file in notebook editor"},{"command":"ipynb.cleanInvalidImageAttachment","title":"Clean invalid image attachment reference"}],"notebooks":[{"type":"jupyter-notebook","displayName":"Jupyter Notebook","selector":[{"filenamePattern":"*.ipynb"}],"priority":"default"}],"notebookRenderer":[{"id":"vscode.markdown-it-cell-attachment-renderer","displayName":"Markdown it ipynb Cell Attachment renderer","entrypoint":{"extends":"vscode.markdown-it-renderer","path":"./notebook-out/cellAttachmentRenderer.js"}}],"menus":{"file/newFile":[{"command":"ipynb.newUntitledIpynb","group":"notebook"}],"commandPalette":[{"command":"ipynb.newUntitledIpynb"},{"command":"ipynb.openIpynbInNotebookEditor","when":"false"},{"command":"ipynb.cleanInvalidImageAttachment","when":"false"}]}},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}}
|
||||
@@ -0,0 +1 @@
|
||||
{"displayName":".ipynb Support","description":"Provides basic support for opening and reading Jupyter's .ipynb notebook files","ipynb.pasteImagesAsAttachments.enabled":"Enable/disable pasting of images into Markdown cells in ipynb notebook files. Pasted images are inserted as attachments to the cell."}
|
||||
Reference in New Issue
Block a user