jupyter-book / jupyterlab-myst

Use MyST Markdown directly in Jupyter Lab
https://jupyter-book.github.io/jupyterlab-myst/
BSD 3-Clause "New" or "Revised" License
141 stars 16 forks source link

export Notebook in pdf #173

Open Mad31 opened 1 year ago

Mad31 commented 1 year ago

Proposal

When i try to export Notebook to HTML or to pdf for example, whe lost all the myst-formatting of the Notebook. I know that the mystV2 works with the markdown renderer but with the Notebook export, it will be fantastic.

Additional notes

jonathan-s commented 9 months ago

I've tried using jupyter-myst 2.1.0, and this issue is still persisting there when trying to export to pdf.

agoose77 commented 9 months ago

Jupyter Lab's exporting feature uses nbconvert under the hood. This extension is only concerned with the frontend experience, and doesn't touch that part of Jupyter.

If you want to generate HTML or PDF MyST, I'd recommend looking at our new CLI tools based upon the same technology that powers jupyterlab-myst, i.e. https://mystmd.org/ There is also our existing Sphinx-based stack, which powers (among other things) documentation (e.g. https://awkward-array.org/doc/main/user-guide/how-to-convert-numpy.html)

aydemiro commented 2 months ago

@agoose77 How does one use myst CLI to export a jupyter notebook to HTML? I cannot see it in the documentation. There is a suggestion to add a frontmatter cell at the top for exporting but HTML is not an option. I have no issues building the notebook and rendering using myst.

agoose77 commented 2 months ago

There's mention of HTML builds in the guide: https://mystmd.org/guide/deployment#creating-static-html

There's also content to discuss PDF exports: https://mystmd.org/guide/creating-pdf-documents#exporting-to-pdf https://mystmd.org/guide/creating-pdf-documents#rendering-pdfs-with-typst

aydemiro commented 2 months ago

Thanks for the speedy response! The html created this way looks fairly terrible when I open it locally (below). It looks good if I start a server npx serve as suggested but I still cannot save an easily sharable html file from the server. I am looking into jupyter-book to see if that can help. It seems like jb has a build html option that generate a more standard html.

Screenshot 2024-06-11 at 1 52 53 PM