jupyterlite-sphinx icon indicating copy to clipboard operation
jupyterlite-sphinx copied to clipboard

Exporting JupyterLite notebook site rooted on ./index.html

Open psychemedia opened this issue 1 year ago • 2 comments

The current build (using the XML formatter) generates an element of the form:

 <NotebookLiteIframe height="600px" iframe_src="lite/tree/" prompt="Try classic Notebook!" prompt_color="True" search_params="false" width="100%">

where the the iframe_src points to the path lite/tree/ which in turn loads assests from the parent dir...

Is it possible to generate a "flat" distribution rooted on ./index.html?

I have a requirement of bundling the site as an html.zip file where the entry point MUST be ./index.html, rather than anything down a path.

psychemedia avatar Mar 21 '24 11:03 psychemedia

As far as I can tell, JUPYTERLITE_DIR = "lite" is set as a global variable here:

https://github.com/jupyterlite/jupyterlite-sphinx/blob/008111d8084e3ce404b01b060937cc1737ec6d7a/jupyterlite_sphinx/jupyterlite_sphinx.py#L33

And "tree" is set at least here:

https://github.com/jupyterlite/jupyterlite-sphinx/blob/008111d8084e3ce404b01b060937cc1737ec6d7a/jupyterlite_sphinx/jupyterlite_sphinx.py#L167

Changing them to empty string make the build fails:

Handler <function overwrite_pygments_css at 0x1038618a0>
     for event 'build-finished' threw an exception
     (exception: [Errno 2] No such file or directory:
      '.../docs/build/html/_static/pygments.css')

So there are likely some interaction between sphinx and jupyterlite itself.

Is that ok, if just the index.html is moved, or do you really need all the lite/tree to also be flatten ?

Carreau avatar Mar 25 '24 09:03 Carreau

In my use case, the assets need to be delivered as a zip file with the index.html at the root and as the only entry point. (The use case is a learning environment that accepts a zip file the contents of which populate an iframe with a hardwired ./index.html src value.

psychemedia avatar Mar 25 '24 14:03 psychemedia