Figure rendering issue on nbviewer

146 views
Skip to first unread message

Antonino Ingargiola

unread,
Jan 19, 2017, 2:59:09 PM1/19/17
to Project Jupyter
Hi to all,

I have some notebooks with images in markdown cells that are not rendered by nbviewer anymore. See for example:


Instead of the figure, nbviewer shows <img width=400 src="figures/5dsDNA_FRET_usALEX.svg">.

Github renders the figure correctly:


Any hints why it is happening?

Antonio

MinRK

unread,
Jan 20, 2017, 4:56:35 PM1/20/17
to Project Jupyter
That looks like a bug in nbconvert where the HTML is getting escaped. I'll open an Issue if I can find out what's up.

My guess is that it's a regression in a recent version and GitHub hasn't upgraded nbconvert and/or uses a custom template, so they aren't affected by the bug.

--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+unsubscribe@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/75fa4af7-e7f7-45ac-8078-ac7d48ec2516%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

MinRK

unread,
Jan 20, 2017, 5:28:31 PM1/20/17
to Project Jupyter

It appears to be a bug in mistune’s parsing of HTML attributes. If you put quotes around the width, it seems to work, so instead of:

<img src="figures/..." width=400>

do

<img src="figures/..." width="400">

This has been fixed in mistune master, but there has not yet been a release. mistune 0.7.4 should be the first version with the fix.

-Min

Antonino Ingargiola

unread,
Jan 20, 2017, 6:47:47 PM1/20/17
to Project Jupyter
Thanks Min, the quoting solved the problem!

Antonio


On Friday, January 20, 2017 at 2:28:31 PM UTC-8, Min RK wrote:

It appears to be a bug in mistune’s parsing of HTML attributes. If you put quotes around the width, it seems to work, so instead of:

<img src="figures/..." width=400>

do

<img src="figures/..." width="400">

This has been fixed in mistune master, but there has not yet been a release. mistune 0.7.4 should be the first version with the fix.

-Min

On Fri, Jan 20, 2017 at 11:56 AM, MinRK <benja...@gmail.com> wrote:
That looks like a bug in nbconvert where the HTML is getting escaped. I'll open an Issue if I can find out what's up.

My guess is that it's a regression in a recent version and GitHub hasn't upgraded nbconvert and/or uses a custom template, so they aren't affected by the bug.
On Thu, Jan 19, 2017 at 9:59 AM, Antonino Ingargiola <trit...@gmail.com> wrote:
Hi to all,

I have some notebooks with images in markdown cells that are not rendered by nbviewer anymore. See for example:


Instead of the figure, nbviewer shows <img width=400 src="figures/5dsDNA_FRET_usALEX.svg">.

Github renders the figure correctly:


Any hints why it is happening?

Antonio

--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+u...@googlegroups.com.

Michael Pacer

unread,
Jan 20, 2017, 9:10:26 PM1/20/17
to Project Jupyter
Just wanted to point out that while that particular bug was fixed with that update, this commit may introduce some problems and cause delays (it looks like this was supposed to take care of the case where html attributes were not delimited by quotes, which is valid html if not advised). I saw some issues with that commit banning empty string attribute values(important for <img> tags' alt attributes) and decided to make a PR to address that, and in the process discovered that mistune fails its tests if run through pytest (rather than nosetests).

So, even if mistune were to issue a new release today, I wouldn't be comfortable bumping the version in nbconvert until that is ironed out. I'm going to try to help with this.

Fortunately, as you point out, wrapping values in quotes works to solve this problem for now.

On Friday, January 20, 2017 at 2:28:31 PM UTC-8, Min RK wrote:

It appears to be a bug in mistune’s parsing of HTML attributes. If you put quotes around the width, it seems to work, so instead of:

<img src="figures/..." width=400>

do

<img src="figures/..." width="400">

This has been fixed in mistune master, but there has not yet been a release. mistune 0.7.4 should be the first version with the fix.

-Min

On Fri, Jan 20, 2017 at 11:56 AM, MinRK <benja...@gmail.com> wrote:
That looks like a bug in nbconvert where the HTML is getting escaped. I'll open an Issue if I can find out what's up.

My guess is that it's a regression in a recent version and GitHub hasn't upgraded nbconvert and/or uses a custom template, so they aren't affected by the bug.
On Thu, Jan 19, 2017 at 9:59 AM, Antonino Ingargiola <trit...@gmail.com> wrote:
Hi to all,

I have some notebooks with images in markdown cells that are not rendered by nbviewer anymore. See for example:


Instead of the figure, nbviewer shows <img width=400 src="figures/5dsDNA_FRET_usALEX.svg">.

Github renders the figure correctly:


Any hints why it is happening?

Antonio

--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+u...@googlegroups.com.
Message has been deleted

Damon Allen

unread,
Jan 21, 2017, 10:18:16 AM1/21/17
to Project Jupyter
I just wanted to add that I'm having the same problem with nbviewer (sort of) 

    <img style="float:right; max-width: 30%; height: auto;" src = "./Images/3D Printing/3D printers.jpg"/>

doesn't render on for me though similarly formatted images do.  These all previously did display.
Reply all
Reply to author
Forward
0 new messages