notebook
notebook copied to clipboard
JN 7 → Code Folding starts at the first line regardless the type
Hi,
Jupyter Notebook 7:
I would like to propose to be able to fold any cell by the first line of text regardless its type.
Reasoning of it is that in many scenarios we have a cell with certain description and funcionality in some type of representation, flow.
Once user of a Notebook reads instructions, it is not necessary to keep the whole cell unfolded, actually it is very beneficial to allow to fold the whole cell keeping only the first row (likely a Title of a cell).
E.g. cell worthy to read and then fold it to see only a title "The Generator X" Cell:
# The Generator X
# This function produces...
A = FunctionX()
# Callable Output
#...
Best, Michal
Thank you @MichalRIcar for submitting this issue! As we use CodeMirror for code folding, this might be either a change to configuration or an improvement to CodeMirror.
The way I read it, this basically requests what was already implemented in https://github.com/jupyterlab/jupyterlab/pull/14141
@MichalRIcar is this correct?
Hi,
I will use an example from JN 6 with this feature on via codefolding extension:
Before Folding
After Folding
As we can see, the "old" codefolding allowed to fold any cell by its first line regardless of its type..very useful feature in notebook presentation.
Sorry but I still do not see how it differs from what was implemented in https://github.com/jupyterlab/jupyterlab/pull/14141.
@krassowski, thank you for pointing this out. You are absolutely correct that these two options are almost identical. However, I can only access the cell collapsing feature through the 'View' menu by selecting 'Collapse Selected Code' or 'Collapse All Code.' Perhaps I'm just missing some optional feature in Jupyter Notebook 7 because I don't see any dynamic option inside a cell to fold a whole code cell - similarly as we see in the example above?
Or idea behind this feature in JN7 is to not provide code folding in a code cell and rather forcing a user to use View option given by dev reasons? Originally (intuitively), I though it will be among these..
You can click on the blue bar next to the cell:
This is somewhat documented in JupyterLab user guide but not in notebook itself. I think we should move the Notebook content User Guide to this repo (recreating videos using playwright) and then just embed it in JupyterLab docs.
Right! That was the first thing I tried and it doesn't work even though I have code folding allowed everywhere in Settings..
Is this dynamic bar folding connected with some other setup in the JN Settings?
Can you provide a recording and check if there are any errors in the JS console?
Absolutely, I've just checked that in JL it works indeed..but JN no luck. I've also checked that JN is not given by a browser - both Chrome and Edge behave same - i.e. no bar code folding behavior.
JS concole has these errors and tons of warnings
Warnings
https://github.com/jupyter/notebook/assets/62614119/73e5a70d-5754-4342-bb34-6d447578af29
The collapsing issue might be similar to the one reported in https://github.com/jupyter/notebook/issues/7020
This active code folding is broken on my machine. I just installed the latest jupyter notebook.