0

When i download .ipynb file using file-->download as html, i get the format as the below screenshot. Each code block get stacked horizontally instead of vertically. I am using jupyter lab using anaconda

enter image description here

Ussu20
  • 129
  • 1
  • 12
  • Odd. I remember recently seeing somebody report something similar [recently](https://stackoverflow.com/q/76781572/8508004); however, I don't think that was when the saved it as HTML. Is it only this file that does it? If it isn't could you share actual HTML code via a code posting /snippet-posting site such as GitHub's gist or something place similar? – Wayne Aug 21 '23 at 18:48
  • How recent is your Anaconda install? Has this always been the behavior? – Wayne Aug 21 '23 at 18:56

1 Answers1

0

You can use nbconvert module to convert jupyter-notebook to HTML.

jupyter nbconvert --to html notebook.ipynb

Edit: nbconvert is integrated with jupyter as @Wayne mentioned.

Aman Maghan
  • 556
  • 5
  • 9
  • when i run this: `jupyter nbconvert --to html finalproject.ipynb` in jupyter notebook, getting invalid syntax error – Ussu20 Aug 21 '23 at 18:49
  • 1
    Jupyter has `jupyter nbconvert` integrated so there is no need for the install you mention, Aman. – Wayne Aug 21 '23 at 18:50
  • You'd need to run `jupyter nbconvert --to html finalproject.ipynb` in the terminal, @Ussu20 . Or add an exclamation point in front of it in order to run it inside a Jupyter cell. – Wayne Aug 21 '23 at 18:52
  • the format is still wrong, get horizontally stacked – Ussu20 Aug 21 '23 at 18:54
  • That makes sense because it is using the same command behind the scenes most likely. But it was worth trying. – Wayne Aug 21 '23 at 18:55
  • can you add `--template lab` as well? `jupyter nbconvert --to html --template lab finalproject.ipynb`. – Aman Maghan Aug 21 '23 at 19:05