ipython-contrib / jupyter_contrib_nbextensions

A collection of various notebook extensions for Jupyter
http://jupyter-contrib-nbextensions.readthedocs.io/en/latest
Other
5.2k stars 805 forks source link

[collapsible_headings] When using jupyter_server + nbclassic, collapsible headings not working #1642

Open yacchin1205 opened 1 year ago

yacchin1205 commented 1 year ago

When using jupyter_server + nbclassic, When I open the notebook in my browser, I get the following error message and collapsible headings does not work. (Triangles at headings are not displayed.)

main.js?v=20230603045922:1076 [collapsible_headings] error: TypeError: Cannot read properties of undefined (reading 'split')
    at patch_Tooltip (main.js?v=20230603045922:598:73)

Steps to Reproduce

  1. Build and run Dockerfile based on docker-stacks or launch the jupyter notebook using MyBinder: https://mybinder.org/v2/gist/yacchin1205/156752d2a08004026f0b10c3a1ff472b/HEAD?urlpath=tree
  2. Once the jupyter notebook server is open, Create the new notebook
  3. Open the notebook
  4. Open your browser's developer tools and you will find the error log above and that collapsible headings does not work.

Cause of this error

This error occurs in the following code.

https://github.com/ipython-contrib/jupyter_contrib_nbextensions/blob/374defd124b636e3337ef8e6249f3c67da6982b8/src/jupyter_contrib_nbextensions/nbextensions/collapsible_headings/main.js#L598

The code expects the global variable sys_info to have a notebook_version, but the combination of jupyter_server and nbclassic seems to provide a sys_info without a notebook_version.

image

Also, nbclassic seems to give 1.0.0 as the Jupyter.version, so we will need to consider that.

https://github.com/jupyter/nbclassic/blob/b3692e330e7452fdb3aef7b53abe51ef22c2cfc5/nbclassic/static/base/js/namespace.js#L76