Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an option to open the Notebook UI and Voici apps in a new tab via theNotebookLite and Voici directives #223

Conversation

agriyakhetarpal
Copy link
Member

@agriyakhetarpal agriyakhetarpal commented Dec 11, 2024

Description

This PR implements #165, but for the Notebook UI and the Voici interface, which come to life via the ..notebooklite:: and .. voici:: directives and notebooks can now be opened in a separate tab instead of within the documentation website. With it, we also receive the added benefit of a smaller button for both directives IFrames, instead of a larger-sized, framed 400px window element on the screen.

Rationale

When running a notebook, the JupyterLite interface displays the entire JupyterLite Lab interface. The ability to use the Notebook UI in a new tab would be useful because it is more minimal and designed for those who do not need to display all the notebooks in the file browser drawer, need access to several other options, etc.

Unlike in JupyterLab, the "Simple Interface" has not yet been directly implemented in JupyterLite (please see jupyterlite/jupyterlite#385). Thus, this change will allow us to offer a reasonable substitute for it at the time, and bring parity between both notebook interface spawners.

The Voici directive can currently open notebook files if a notebook is not supplied to it. However, it, too, occupies a lot of space and one has to first load Voici and then open a notebook. By adding a "new tab" button, we have the provision to skip this step and open the notebook directly, and save space on the screen similar to the "-Lite" directives. This brings parity between all three major directives (the Replite console is not relevant here).

Changes made

  • Abstracted the "open in a new tab" functionality with a "base" class for the tabbed versions of both JupyterLite and NotebookLite directives
  • Created a tabbed interface for the Voici directive
  • Added docs for the new :new_tab: option for the NotebookLite directive and clarified the difference between both directive's "new tab" options
  • Added docs for the new :new_tab: option for the Voici directive

Additional context

After this change, the NotebookLite directive can be used in place of the JupyterLite directive for many of SciPy's interactive notebooks under scipy.stats: https://scipy.github.io/devdocs/tutorial/stats/hypothesis_tests.html, so that a notebook, when opened in a new tab, can occupy the full width on the screen (and distracting elements such as other notebooks in the UI and extra buttons can also be reduced).

cc: @melissawm, @steppi

@agriyakhetarpal agriyakhetarpal added the enhancement New feature or request label Dec 11, 2024
@agriyakhetarpal agriyakhetarpal force-pushed the feat/new-tabs-for-notebooklite-directive branch 2 times, most recently from 7d23d92 to 2e76eff Compare December 12, 2024 00:35
@agriyakhetarpal agriyakhetarpal changed the title Add an option to open the Notebook UI in a new tab via the NotebookLite directive Add an option to open the Notebook UI and Voici apps in a new tab via theNotebookLite and Voici directives Dec 12, 2024
@agriyakhetarpal
Copy link
Member Author

Initially, I planned for this improvement to be limited to just the NotebookLite directive, but the same thing for the Voici directive wasn't much trouble to implement either (please see the "Rationale" section in the PR description). We could restrict it to being just for the NotebookLite directive if needed.

@agriyakhetarpal agriyakhetarpal force-pushed the feat/new-tabs-for-notebooklite-directive branch from 2e76eff to f6c4731 Compare December 13, 2024 10:32
@agriyakhetarpal
Copy link
Member Author

Rebased on top of main and checked all directives on the Read the Docs PR preview again, they are working as expected. Thanks for the review, @Carreau!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants