Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support pasting of images from clipboard in markdown cells of Notebooks #119961

Closed
DonJayamanne opened this issue Mar 26, 2021 · 13 comments
Closed
Assignees
Labels
feature-request Request for new features or functionality markdown Markdown support issues notebook-markdown on-testplan
Milestone

Comments

@DonJayamanne
Copy link
Contributor

@RandomUserrr commented on Thu Mar 25 2021

when i want to insert local image into a cell nothing happens :(

Extension version: 2021.5.685944597
VS Code version: Code - Insiders 1.55.0-insider (6ebe2a1, 2021-03-25T16:25:06.257Z)
OS version: Windows_NT x64 10.0.19042


@DonJayamanne commented on Thu Mar 25 2021

Thanks for filing this issue, please could you provide some steps on what you have tried and what you mean by inserting local image? I.e. steps for us to be able to repro this issue.


@RandomUserrr commented on Thu Mar 25 2021

I took a screenshot and want to insert an image via ctrl + v. this works in jypiter notebook but doesn't work in vscode

@DonJayamanne DonJayamanne changed the title Local images cannot be inserted Support pasting of images from clipboard in markdown cells of Notebooks Mar 26, 2021
@rebornix
Copy link
Member

This is what's inserted into the cell when pasting.

image

It's a generic request for pasting images in markdown editor but can also be a special paste handler for notebook.

@rebornix rebornix assigned mjbvz and unassigned rebornix Mar 26, 2021
@rebornix rebornix added notebook-markdown markdown Markdown support issues feature-request Request for new features or functionality labels Mar 26, 2021
@rebornix rebornix added this to the Backlog milestone Mar 26, 2021
@rndxx
Copy link

rndxx commented Mar 26, 2021

@rebornix nothing happens when inserting. empty cell. How to fix it? I got a new problem when entering a request . the image is not displayed

image

@mjbvz
Copy link
Collaborator

mjbvz commented Mar 31, 2021

This probably falls under #30066

instead of implementing a notebook specific solution, it would be great if our markdown language features supported this in any markdown files

@jucor
Copy link

jucor commented Nov 2, 2021

Would be extremely helpful, I have been using it all the time in JupyterLab to paste content from multiple sources: tables with classnames for datasets, tables with required format from the end-user of the data, etc etc. Quite handicapping not having it!
Thanks for considering :)

@greazer
Copy link
Member

greazer commented Apr 12, 2022

This request has been referenced in the Jupyter extension's marketplace review on 4/11/2022.

@greazer
Copy link
Member

greazer commented May 9, 2022

If it's not clear from the above, please keep in mind the direction tools like Jupyter have implemented this (as I have been told... I haven't verified this myself). Instead of adding references to files on disk (or otherwise), it will simply convert images to base64 and embed them directly into the markdown as text. This way a notebook can be passed around without needing to ensure that referenced image files are included.

@mariandumitrascu
Copy link

This would be such a great addition. Copy/pasting images from clipboard is the only thing that makes me switch some times to JupyterLab from VSCode.

@rchiodo
Copy link
Contributor

rchiodo commented May 9, 2022

Jupyter doesn't put it into the markdown itself, but rather adds an 'attachment' entry into the cell json. Something like so:

{
 "cells": [
  {
   "attachments": {
    "image.png": {
     "image/png": "iVBORw0KGgoAAAANSUhEUgAAATsAAAB6CAYAAADAr/S6AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAABi9SURBVHhe7Z0NsBbVecfPi3YEiZNpJmKLCIix47Q1RouokSsyGptpAoHgVQS5VmzTToJWIuAHaq+aiwgoTiGZaTsB5SoCF5ReO5mMIyVwIX5AIkWnMkGRG4OkfnSmMYBW9O3+9+6zPO9hv/fd+7X/38wZuO++e....

This is described here:
https://nbformat.readthedocs.io/en/latest/format_description.html#cell-attachments

@mjbvz
Copy link
Collaborator

mjbvz commented May 10, 2022

Once we expose an api for copy/paste, this should be handled by Jupyter (I'll leave it up to you if this means our built-in simple extension or by the full one)

@rchiodo rchiodo removed their assignment May 10, 2022
@rchiodo
Copy link
Contributor

rchiodo commented May 10, 2022

I believe @amunger was looking at this this month.

@DonJayamanne
Copy link
Contributor Author

DonJayamanne commented May 16, 2022

Rendering pasted images in Jupyter Notebook markdown cells will be blocked on #121256
@mjbvz /cc

@Yoyokrazy
Copy link
Contributor

Pasting images from the clipboard into a markdown cell is released! It requires enabling the following two settings:

"ipynb.experimental.pasteImages.enabled": true,
"editor.experimental.pasteActions.enabled": true,

@rzhao271 rzhao271 added verification-needed Verification of issue is requested on-testplan and removed verification-needed Verification of issue is requested labels Aug 29, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Oct 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality markdown Markdown support issues notebook-markdown on-testplan
Projects
None yet
Development

No branches or pull requests

13 participants