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

Attached image not exported if referenced from <img> tag #1057

Open
memeplex opened this issue Jun 30, 2019 · 9 comments
Open

Attached image not exported if referenced from <img> tag #1057

memeplex opened this issue Jun 30, 2019 · 9 comments
Milestone

Comments

@memeplex
Copy link

I know of #699. Nevertheless I find it confusing because I can easily export to html or reveal.js and the images are there as far as I reference them using ![]() syntax. Now, as this is very limited in terms of formatting, many times I need to use an <img> tag instead, and then the attachments aren't exported to the output.

  1. Take a screenshot, copy & paste it into some notebook cell.
  2. Download the notebook as html or reveal.js: ok, the image is still there.
  3. Replace the markdown image syntax by the corresponding html syntax, referencing the same url (for example, "attachment:image.png").
  4. Render the cell: ok, the image is still there.
  5. Download the notebook as html or reveal.js: the image has disappeared!

Nbconvert version: 5.5.0

@xiaohk
Copy link

xiaohk commented Jul 17, 2019

Same issue here. I usually use <img> for better image formatting. Hopefully nbconvert can support it.

@xiaohk
Copy link

xiaohk commented Jul 19, 2019

I solved it by adding the images in the correct path (relative to my html files) used in the <img> tags.

@MSeal
Copy link
Contributor

MSeal commented Jul 22, 2019

Yes it likely is related. The way attachments got implemented in notebooks was fairly organic and this caused some difficult-to-fix issues for exporting to other formats. @xiaohk is the best work-around for now until that code path gets cleaned up (likely a 6.0 feature).

@axil
Copy link

axil commented Oct 22, 2019

I tried a lot of workarounds too, and eventually ended up with the same thing that @xiaohk described.

@wstomv
Copy link

wstomv commented Feb 5, 2020

I solved it by adding the images in the correct path (relative to my html files) used in the <img> tags.

@xiaohk
Can you explain how to do this, using a concrete example?

Does it apply to my situation, where I have a MarkDown cell with an attached image, shown via MarkDown syntax (not an HTML <img> tag; not an external image file).

I also tried nbconvert with an image that is embedded through data: and een encoded image. This also did not work for me.

@callegar
Copy link

Also the jupyter lab File->Print functionality is affected by this issue.

@n2ygk
Copy link

n2ygk commented Oct 5, 2021

I ended up doing jupyter nbconvert --to html and then opening the html in the browser and print/save to PDF. Not the best workflow for sure but at least the images get rendered. The images were in the correct path but still didn't render.

@jhgoebbert
Copy link

Often I need to resize images which I have inserted quick&easy with drag&drop to a notebook.
This is (to my knowledge) from within JupyterLab only possible with <img> so that one ends up with:

<img src="attachment:9390596b-a5ba-4fdb-94b4-88995bc1e539.png" width="500"/>

GitHub can render notebooks with such elements, but nbconvert does not support it. An export of the notebook to PDF or HTML fails.

@i2000s
Copy link

i2000s commented Jul 12, 2023

Any update?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants