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

Cell with HTML page renders incorrectly in NBViewer #316

Open
ElDeveloper opened this issue Jul 21, 2014 · 12 comments
Open

Cell with HTML page renders incorrectly in NBViewer #316

ElDeveloper opened this issue Jul 21, 2014 · 12 comments
Labels
type:Bug An unexpected behavior

Comments

@ElDeveloper
Copy link

I have an object that displays some HTML when called from an IPython notebook using the _repr_html_ method. The result is as expected in the IPython notebook, however when I view file from nbviewer, some weird things happen.

Problematic notebook:
http://nbviewer.ipython.org/gist/ElDeveloper/24a383b778943a187966

You should be able to download this file and view the correct output in your machine.

@icook
Copy link
Contributor

icook commented Aug 21, 2014

I attempted to replicate your problem with little luck. It seems WebGL support is not so good on Linux with 3+ year old graphics card, haha. When I did get it to render the main render area expanded downward continually until the browser crashed.

Do you perhaps have an example of this bug that doesn't use WebGL?

@ElDeveloper
Copy link
Author

The problem you are describing is exactly the one that I experienced
when using nbviewer, however when I open that notebook from a running
IPython server, it all works just fine. Thanks for looking into it. I
can create a WebGL-less version of the content later tonight.

On (Aug-21-14|11:39), Isaac Cook wrote:

I attempted to replicate your problem with little luck. It seems WebGL support is not so good on Linux with 3+ year old graphics card, haha. When I did get it to render the main render area expanded downward continually until the browser crashed.

Do you perhaps have an example of this bug that doesn't use WebGL?


Reply to this email directly or view it on GitHub:
#316 (comment)

@icook
Copy link
Contributor

icook commented Aug 22, 2014

Just updated to the latest Chrome which seems to have helped quite a bit (doesn't crash anymore...). To clarify what I'm getting:

  1. If I download directly from the Gist and load into a running notebook it showed nothing. If I signed the notebook as trusted then it would display the render, but way too small to be useable.. (about 50px tall).
  2. If I select Download As -> HTML from the menu it loads same as the viewer. I believe this is essentially all the viewer does to perform rendering.

This seems to be more related to different HTML bounding boxes between the html view mode of ipython and the notebook editing mode. Might also be a security thing? Possibly some JS isn't getting executed on the exported version since it's untrusted? Either way, I'm not sure it's something that's within the viewers scope to resolve since these are both mechanisms of IPython itself.

@ElDeveloper
Copy link
Author

Thanks for testing this out @icook!

That notebook was working a few weeks ago, in any case I just created a new notebook that renders correctly when running IPython locally i. e. this time it actually shows the content in the cell at a usable size:

screen shot 2014-08-22 at 4 29 38 pm

However when I go to nbviewer the content expands increasingly, see this link and the animated gif below:

nbviewer-emperor-problem

If you see in the notebook, the way that I'm rendering the code is by using:

from IPython.display import HTML, display
display(HTML(x), metadata=dict(isolated=True))

My guess is that the isolated=True part of the metadata is not being honored in nbviewer, not sure if this is to be expected or not.

@Carreau
Copy link
Member

Carreau commented Aug 23, 2014

O_o Nice bug. Sorry, we are all more or less overwhelmed, and indeed it is not wrapped in a iframe

@rgbkrk
Copy link
Member

rgbkrk commented Aug 24, 2014

Can you try running nbconvert on your notebook manually to see how the produced HTML behaves?

ipython nbconvert notebook.ipynb

@ElDeveloper
Copy link
Author

Sadly the produced HTML presents the same problem as the nbviewer render.

The result of the conversion can be found here.

@icook
Copy link
Contributor

icook commented Aug 26, 2014

I've taken a whack at solving this, but the solution is incomplete. (https://github.com/icook/ipython/commits/316). Height doesn't seem to adjust, and I'm getting some JS errors from the Emperor demo when rendered in this way. I tried to basically mimic what the live viewer does (https://github.com/icook/ipython/blob/master/IPython/html/static/notebook/js/outputarea.js#L340). I'll keep working on it as time permits.

@ElDeveloper
Copy link
Author

Awesome!! 👍

@Jorge-C
Copy link

Jorge-C commented Mar 7, 2015

Friendly ping, this is still an issue :'(

@Carreau Carreau added the type:Bug An unexpected behavior label Mar 7, 2015
@bollwyvl
Copy link
Contributor

bollwyvl commented Mar 7, 2015

Please, can someone provide a current link to an .ipynb in an anonymous (and therefore immutable) gist, broken with this bug, that isn't broken in other ways (webgl, missing assets)? We don't have phantom/casper tests yet, but we can add them if we have something reproducible.

@ElDeveloper
Copy link
Author

Sorry for that, I was pointing to a constantly changing URL for the
resources that the page needs to render. I've made a separate copy that
will remain static: http://nbviewer.ipython.org/gist/ElDeveloper/8f38e9bb68f7dce7e694

I apologize for that! Let us know if there's anything we can help with.

On (Mar-07-15|14:34), bollwyvl wrote:

Please, can someone provide a current link to an .ipynb in an anonymous (and therefore immutable) gist, broken with this bug, that isn't broken in other ways (webgl, missing assets)? We don't have phantom/casper tests yet, but we can add them if we have something reproducible.


Reply to this email directly or view it on GitHub:
#316 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:Bug An unexpected behavior
Projects
None yet
Development

No branches or pull requests

6 participants