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.
-
4No, if you like to discuss it, you can contact me or other IPython core dev privately. – Matt Jan 10 '14 at 16:35
7 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

- 2,140
- 4
- 24
- 35
-
10This is for folding the code within a cell. I believe what the original poster was asking was how to collapse an entire iPython cell. – Seanny123 Jul 16 '14 at 01:14
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.
I did that with jquery.
- You need to "print preview" your notebook.
- from the browser console: jQuery(".input").hide()

- 229
- 3
- 13
hide_input_all extension will hide all input cell. and hide_input will hide the code cell that currently has the focus. my testing shows that all you need to do is loading the hide_input
extension.
IPython.load_extensions('usability/hide_input/main');

- 8,753
- 4
- 39
- 64
-
Second link appears broken, but first link and extension therein works great! – aquirdturtle May 21 '16 at 01:03
I installed runtools and it works for me. You can fold one or all marked input cells.
https://github.com/ipython-contrib/IPython-notebook-extensions/tree/master/usability/runtools

- 11
- 1
-
-
1@aquirdturtle They appear to have deleted the whole repo IPython-notebook-extensions and replaced it with jupyter_contrib_nbextensions (link that works: https://github.com/ipython-contrib/jupyter_contrib_nbextensions/tree/master/src/jupyter_contrib_nbextensions/nbextensions/runtools) – Fi Zixer May 27 '17 at 03:35
I spent a long time trying to get the codefolding extension to work with my setup, but I couldn't get it to work, even after trying many things including this stackoverflow suggestion. And I probably would have preferred that. However, I did find this page which talks about hiding code cells:
http://blog.nextgenetics.net/?e=99
I ended up putting this snippet in my custom.js and it worked perfectly:
Now under my 'View' menu, I have a 3rd option to 'toggle code cells'. It toggles to hide/show only the input, while always showing the output, which is what I'm looking for. State of toggle is not preserved across saving/reopening file as it would have been with codefolding

- 1
- 1

- 540
- 2
- 8
Yes! :) There now is one! :)
jupyter notebook extensions is a collection of extensions including, but not limited to:
- code folding
- Collapsible Headings
- and many, many more...
The second one can be used to collapse jupyter notebooks on the headers, thus hiding entire sections of cells at once. I just found this and am currently (and probably for the next hour or so) thinking that this is the coolest invention, after sliced bread.
You can even install the whole bunch with a single anaconda command,
conda install -c conda-forge jupyter_nbextensions_configurator
This installs the extensions configurator which integrates them to jupyter and allows you to enable/disable them at will with a click.
Also, the following function should be available in the latest jupyter: triple clicking completely hides output The same happens if you press 'o' in the command mode: it hides the output of the cell in focus.

- 12,950
- 7
- 74
- 95