Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to convient fold/unfold an ipython cell?

Now ipython notebook could easily hide the output part of a cell by double clicking the left margin of the output. But I havn't figure out a way to hide the whole cell content.

like image 222
NathaneilCapital Avatar asked Jan 10 '14 15:01

NathaneilCapital


People also ask

Is there a way to collapse cells in Jupyter Notebook?

To collapse the heading, use the triangle on the left of the markdown cell.

What is code folding in Jupyter Notebook?

This extension adds codefolding functionality from CodeMirror to a codecell. In edit mode, clicking on the triangle in the gutter (left margin of codecell) or typing the codefolding hotkey (default is Alt+F ), folds the code. In command mode, the folding hotkey relates to the first line of the codecell.


2 Answers

Not sure if this is still relevant but the following code folding extension may help:

https://github.com/ipython-contrib/IPython-notebook-extensions/wiki/Codefolding

like image 87
Moses Xu Avatar answered Sep 18 '22 09:09

Moses Xu


If you are running juptyter, then this is relevant: collapse cell in jupyter notebook

In my case, I like the hide_cost extension. Install as

pip3 install hide_code 

Visit https://github.com/kirbs-/hide_code/ for more info about this extension.

like image 27
Linas Avatar answered Sep 18 '22 09:09

Linas