-
Notifications
You must be signed in to change notification settings - Fork 0
Codefolding
This extension adds codefolding functionality from CodeMirror to a codecell. This functionality is still evolving and will improve in the next versions of CodeMirror.
After clicking on the gutter (left margin of codecell) or typing Alt+F, the code gets folded. See the examples below. The folding status is saved in the cell metadata of the notebook, so reloading of a notebook will restore the folding view.
Three different folding modes are supported.
Python-style code folding, detetects indented code.

The unfolded code above can be folded like this:
or this:
For other languages like Javascript using brackets to designate code blocks. This works e.g. for Javascript in using the %%javsscript magic in a codecell.
Allows collapsing of Python code cells to a single comment line. This is useful for long codecells. The algorithm simply looks for a comment in the first line and allows folding in the rest of the cell.

The code above can be folded like this:
Copy the codefolding directory to you /static/custom directory of your IPython profile and add
require(['/static/custom/codefolding/codefolding.js'])to your custom.js file.
If the codefolding does not always work correctly, try updating the codemirror component of IPython with the current Github master one. Codefolding is still in active development.
Aspell
Breakpoints
Chrome Clipboard
Codefolding
Comment Uncomment
Drag and Drop
Execute Timings
Help Panel
Hide Input All
Hierarchical Collapse
International Keymap
Javascript Highlighter
LaTeX Environments
Limit Output
Linenumbers
Navigation Hotkeys
Nbconvert Button
Printview Button
Printviewmenu Button
Python Markdown
Readonly
Rubberband
Runtools
Search & Replace
Search
Shift-Tab 3.x
Skip Traceback


