Reputation: 2783
Is it possible to use jupyter_contrib_nbextensions extension like "Collapsible Headings" in nbviewer?
I've managed to use it locally by doing the following steps:
# Install Jupyterextension package
pip install jupyter_contrib_nbextensions
jupyter contrib nbextension install
# Install configurator and enable configurator
pip install jupyter_nbextensions_configurator
jupyter nbextensions_configurator enable
Then I've just enabled "Collapsible Headings" in nbextensions configurator panel.
But when I've uploaded the notebook to the GitHub and then tried to open it with nbviewer or mybinder it launched the notebook but without collapsible heading support.
How can I "tell" nbviewer or mybinder that I need them to use "Collapsible Headings" extensions? I've updated my requirements.txt file and added jupyter_contrib_nbextensions dependency to it but it looks like it is not enough...
Upvotes: 3
Views: 564
Reputation: 2783
By following @AdrienPacifico and mybinder documentation suggestions I've managed to have jupyter_contrib_nbextensions installed and activated for both - my local Jupyter server and for mybinder server by simply putting all extension activation instructions into postBuild
file in the root of my repository.
Here are examples of requirements.txt
and postBuild
files that activate collapsible_headings extension:
requirements.txt
jupyter==1.0.0
jupyter-contrib-nbextensions==0.5.0
postBuild
jupyter contrib nbextension install --user
jupyter nbextension enable collapsible_headings/main
After launching a repository with these files in mybinder the collapsible_headings extensions will be activated automatically for every users.
The only question I still have though is to how we can preserve the same look-and-feel for nbviewer also...
Upvotes: 2