Running JupyterLab version 3.0.0 and would like to enable code folding (collapse classes, functions etc in Python). I have followed the instructions in this Jupyter Lab github post:
Under Settings / Text Editor, I have these User preferences (right pane):
{
"editorConfig": {
"lineNumbers": true,
"codeFolding": true
}
}
And I do not see any triangles appearing on the left side of the cells. What else do I need to do in order to enable code folding?
For abundance of clarity, this question pertains to JupyterLab specifically.
You CAN collapse an entire cell if you put a #comment at the top of the cell. Jupyter then provides a drop down arrow that will collapse the entire cell.
There is a shortcut for that: use o (that is the letter o) in the command mode to expand/collapse.
Access the Jupyter Menu Simply hit the “Tab” key while writing code. This will open a menu with suggestions. Hit “Enter” to choose the suggestion.
Jupyter lab: ctrl + z shortcut only for selected cell rather than all modified ones. Ask Question.
sudo -E pip install jupyter_contrib_nbextensions Next, add the notebook extension style files to the Jupyter configuration files. sudo -E jupyter contrib nbextension install --sys-prefix Then, you will enable the extensions you would like to use.
The nbconvert is a perfect tool for exporting Jupyter Notebook to other formats, like HTML or PDF. It has argument --no-input to hide the code in the exported notebook. The example command that converts ipynb file to HTML: The above command with produce my-notebook.html file without code.
The preprocessor is installed when you install the jupyter_contrib_nbextensions package. To activate the preprocessor manually, add the following lines to jupyter_nbconvert_config.py:
sudo -E jupyter contrib nbextension install --sys-prefix. Then, you will enable the extensions you would like to use. The syntax for this is jupyter nbextension enable followed by the path to the desired extension’s main file. For example, to enable scratchpad , you would type the following: sudo -E jupyter nbextension enable scratchpad/main ...
Those instructions are specifically for the text editor, not the notebook interface.
Try this instead, in Settings / Notebook:
{
"codeCellConfig": {
"codeFolding": true
}
}
If you want to enable code folding for Markdown or raw cells, see markdownCellConfig
and rawCellConfig
respectively.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With