Skip to content

Test: ipynb image attachment renderer #156380

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

Closed
3 tasks done
Yoyokrazy opened this issue Jul 26, 2022 · 9 comments
Closed
3 tasks done

Test: ipynb image attachment renderer #156380

Yoyokrazy opened this issue Jul 26, 2022 · 9 comments

Comments

@Yoyokrazy
Copy link
Contributor

Yoyokrazy commented Jul 26, 2022

Refs: #119961 #155777

Complexity: 2

Authors: @Yoyokrazy


Summary:

VScode now supports the builtin rendering of images within markdown ipynb cells when stored as attachment encoded base64 data.

Basics:

  • Within vscode/extensions/ipynb/src is now the file cellAttachmentRenderer.ts which extends the markdown renderer implemented inside the builtin markdown-language-features extension. There is a new image rule extended, which access and renders the attached base64 image data from within the cell metadata when the markdown source references !()[attachment:filename.filetype]

Steps to Test:

This is specifically a test to render images from notebooks that are created outside of vscode. Previously, vscode did not support images referenced via attachment metadata. Follow the procedure below:

  • Launch jupyter notebooks web client via conda or the command line with python using python -m notebook
  • Create a new notebook inside the web client and create the following cases
    • Take a screenshot and paste it into a markdown cell
    • Take multiple screenshots and paste multiple into the same markdown cell. This will create !()[attachment:image.png] , !()[attachment:image-2.png] , !()[attachment:image-3.png] etc.
    • Copy a png file and paste it into a cell (this will have the format of !()[attachment:filename.png] isntead of !()[attachment:image.png]
  • Save the file in jupyter, and re-open inside vscode with just the builtin ipynb extension

Things to Check:

  • The images all render
  • The correct images render in the correct locations
  • Cells with multiple images render in the proper order
@bpasero
Copy link
Member

bpasero commented Jul 27, 2022

@Yoyokrazy would you please find volunteers for testing, thanks.

@IanMatthewHuff IanMatthewHuff self-assigned this Jul 27, 2022
@rzhao271 rzhao271 self-assigned this Jul 27, 2022
@rzhao271 rzhao271 added this to the July 2022 milestone Jul 27, 2022
@amunger
Copy link
Collaborator

amunger commented Jul 27, 2022

there was an issue with how the scripts were built, should be fixed in the next insiders publish with #156469

@IanMatthewHuff IanMatthewHuff removed their assignment Jul 27, 2022
@rebornix rebornix self-assigned this Jul 27, 2022
@sadasant
Copy link

I'll test on Linux!

@sadasant sadasant self-assigned this Jul 28, 2022
@sadasant
Copy link

sadasant commented Jul 28, 2022

On Linux:

  • The jupyter notebooks web client is not allowing me to upload more than one picture consistently.
    • I was able to upload one picture, and then it stopped working.
    • If I add new cells, I still can’t upload another picture.
    • I can only upload another picture by creating a new notebook.
    • Even if I can upload one picture per notebook, the path to this picture isn't good. I have the picture in Downloads and the path ends up only having the name, without the folder nor the rest of the path to that picture.
  • After opening the same file in VSCode, I can't see the picture.

Screenshots:

Screen Shot 2022-07-27 at 9 44 36 PM

Screen Shot 2022-07-27 at 9 44 48 PM

I don't think this is a VSCode issue per se. It seems like a Jupyter bug 🤔

@sandy081 sandy081 removed their assignment Jul 28, 2022
@hediet
Copy link
Member

hediet commented Jul 28, 2022

It works, but I wasn't able to paste pictures from the explorer into Jupyter (only screenshots from my screenshot tool worked).

@hediet hediet removed their assignment Jul 28, 2022
@amunger
Copy link
Collaborator

amunger commented Jul 28, 2022

@sadasant - can you retry with the update from last night, images should be rendering with the latest insiders patch

@Yoyokrazy
Copy link
Contributor Author

Yoyokrazy commented Jul 28, 2022

  • Even if I can upload one picture per notebook, the path to this picture isn't good. I have the picture in Downloads and the path ends up only having the name, without the folder nor the rest of the path to that picture.

@sadasant This is actually expected behavior. Jupyter brings along the file name, but the image itself is just converted into base64 data and kept behind the notebook. There's no reference to the original file itself. Likely for the idea of keeping notebooks as portable as possible without needing people to transfer the image files as well.

As for the three points above that, not totally sure about the stability of Juypter's functionality, seems like they might have some bugs...

@rzhao271 rzhao271 removed their assignment Jul 28, 2022
@sadasant
Copy link

@amunger ok cool! now the image does display! Yay!!

@Yoyokrazy ok thank you! Yeah I think Jupyter has some bugs, at least in Linux.

So, things look good from what I can tell, given the limitations of Jupyter on linux.

@rebornix
Copy link
Member

The image attachment preview looks good, great work!

There is only one bug that we throw an error when we fail to find an image attachment and break the whole markdown preview, I'll suggest we have it fixed before release. We may also want to explore how to prevent markdown renderer plugins bring down the whole markdown preview. cc @mjbvz

@rebornix rebornix removed their assignment Jul 28, 2022
@sadasant sadasant removed their assignment Jul 28, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Sep 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

9 participants