nbconvert icon indicating copy to clipboard operation
nbconvert copied to clipboard

Rendering of HTML in '--to html' seems completely broken

Open cunnane opened this issue 1 year ago • 2 comments

My notebook:

display(HTML("<P>BUG?</P>"))

Renders in nbconvert 7.6.0 (and 6.5.4) as:

<P>BUG?</P>

I would except it to render the same as jupyter, i.e. process the HTML tags.

I'm running jupyter nbconvert --execute --to html NoteBook.ipynb. I've tried without the execute flag but the result is the same.

This seems so fundamental that I'm sure I must have a config error somewhere but I'm not sure how to proceed.

Thanks!

cunnane avatar Jun 29 '23 14:06 cunnane

I tested with a notebook containing the cell

from IPython.display import display, HTML
display(HTML("<P>BUG?</P>"))

And the --to html output contains the string <P>BUG?</P> which seems to me to be the correct and expected behavior. My understanding is that HTML(x) is marking x as pre-formatted HTML that does not need further processing. As far as I can tell I get the same output in Jupyter Lab. i.e. NoteBook.html generated by nbconvert (7.6.0) and NoteBook.ipynb viewed in JupyterLab (4.0.2) both look similar in my browser.

What processing do you expect --to html to perform?

jstorrs avatar Jul 09 '23 21:07 jstorrs

I expected it to produce an output which looks (more or less) the same as if I screenshot jupyter. If I execute the above in a notebook cell, the HTML is sent for rendering and I see just the text without the tags. When running nbconvert, I see the literal string <P>BUG?</P> with the tags when I open the resulting html file in a browser. If you're seeing the same between both approaches, it's very possibly a setup issue my side, but I have tried with the fresh python distribution and reached the same result

cunnane avatar Aug 02 '23 16:08 cunnane