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

Rendering fails if the cell-output contains a HTML with a </div> tag #661

Open
krlng opened this issue Nov 25, 2021 · 4 comments
Open

Rendering fails if the cell-output contains a HTML with a </div> tag #661

krlng opened this issue Nov 25, 2021 · 4 comments

Comments

@krlng
Copy link

krlng commented Nov 25, 2021

mknotebooks does not display the output of a cell correctly, if that output contains HTML. It looks like it breaks the output of a cell at the first </div> tag, even if that one is nested within the actual cell-output and therefore should not close the whole cell-output.

In the jupyter notebook it get's rendered correctly:

Screenshot 2021-11-25 at 16 23 38

While within the mknotebooks-docs only the first can be displayed and the second already gets a new output cell:

Screenshot 2021-11-25 at 16 22 33

@timvink
Copy link
Contributor

timvink commented Nov 30, 2021

Are you sure the output HTML is valid? Can you provide a reproducable example?

@krlng
Copy link
Author

krlng commented Dec 1, 2021

I thing I found the reason. mknotebooks has a problem with a HTML outputs where a </div> directly followed by a \n.
It can be fixed by placing an empty space between those

html_str = """
    <div><span>with_space 1</span></div> 
    <div><span>without_space 2</span></div>
    <div><span>with_space 3</span></div> 
    <div><span>without_space 4</span></div>
    <div><span>with_space 5</span></div> 
"""

from IPython.display import HTML

HTML(html_str.replace("\n"," \n")) # works 

HTML(html_str) # breaks for heading 3 and 5, so always in lines without a space between </div> and \n

@greenape
Copy link
Owner

greenape commented Dec 1, 2021

Which version of nbconvert is installed?

@krlng
Copy link
Author

krlng commented Dec 1, 2021

nbconvert-6.1.0-py3, habe jetzt aber auch noch auf 6.3 geupdated, ändert nichts. MacOS 11.6

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

3 participants