jupyterlite / jupyterlite-sphinx

Sphinx extension using JupyterLite to render Notebooks
https://jupyterlite-sphinx.readthedocs.io/en/latest
BSD 3-Clause "New" or "Revised" License
68 stars 21 forks source link

Add the option to open JupyterLite window in new tab #165

Closed melissawm closed 6 months ago

melissawm commented 7 months ago

My use case is the following: I'd like to use the jupyterlite directive to open the full page I am visiting as a Jupytext notebook. This PR adds that option to the JupyterLite directive.

Pending is finding the correct path for opening the current file as an ipynb file: since the source is an .md file, it will be converted into an .ipynb file at some point in the build process. For now, however, Sphinx can't process the directive since it will try to embed a link to the ipynb file before reading the current source .md file, and complain about the missing reference.

I am not sure if I am following the right path here so please let me know if I should approach this differently.

cc @agriyakhetarpal

melissawm commented 7 months ago

Here is an example of this working (partially): https://melissawm.github.io/scipy/tutorial/stats/sampling.html

martinRenou commented 7 months ago

Thanks for contributing!

It's deployed in the readthedocs preview: https://jupyterlite-sphinx--165.org.readthedocs.build/en/165/directives/jupyterlite.html

Changes look good to me. I was about to suggest doing the same for other directives, but when we implement https://github.com/jupyterlite/jupyterlite-sphinx/issues/114, we can make sure the :new_tab: parameter works well with the coming :app: parameter, so let's not bother about this in this PR?

Leaving this open to let other people have a look.

melissawm commented 7 months ago

I'm happy to do a follow up for that in the future, I might need some time togo over the app parameter and understand the effects if that's alright. Thanks!

Carreau commented 6 months ago

Completely forgot to merge, sorry. Merging.