Skip to content
| Marketplace
Sign in
Visual Studio Code>Notebooks>Notebook Heading FoldNew to Visual Studio Code? Get it now.
Notebook Heading Fold

Notebook Heading Fold

Shahrukh Chishti

|
1 install
| (0) | Free
Fold every ## or ### section of a Jupyter notebook in one click, and browse its headings in an outline tree.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Notebook Heading Fold

Fold a long Jupyter notebook down to its outline in one click.

VS Code can fold a notebook section by section, but there is no built-in way to fold all sections of a given level at once. This extension adds that, plus an outline of the notebook's headings that you can collapse by level on its own.

Features

Fold every ## or ### section

Two buttons appear in the notebook toolbar:

Button What it does
H2 Folds every section that starts with a ## heading cell
H3 Folds every section that starts with a ### heading cell

Fold at H2 to see the chapter outline of a notebook. Fold at H3 to keep the chapters open and hide the detail inside them. Unfold as usual with the chevron next to each heading cell.

Empty sections (a heading followed directly by another heading of the same or a higher level) are skipped, so folding never collapses the section around them.

Headings outline

A Headings view appears in the Explorer whenever a notebook is open. It lists every markdown heading in the notebook as a tree.

  • Click a heading to select its cell and scroll it into view.
  • Use the H2 / H3 buttons in the view's title bar to collapse the tree at that level. This folds only the tree, not the notebook.
  • Collapse All folds the tree completely.

The outline updates as you edit the notebook.

Commands

All commands are also available from the Command Palette while a notebook is active.

Command Description
Notebook: Fold ## Sections Fold every ## section of the notebook
Notebook: Fold ### Sections Fold every ### section of the notebook
Notebook: Collapse Headings Tree at ## Collapse the Headings view at ##
Notebook: Collapse Headings Tree at ### Collapse the Headings view at ###

Bind any of them to a key in Keyboard Shortcuts (nbHeadingFold.foldH2, nbHeadingFold.foldH3, nbHeadingFold.treeFoldH2, nbHeadingFold.treeFoldH3).

How headings are found

Markdown cells are parsed with marked, the same parser VS Code uses for its own notebook folding, so a heading here is a heading there. Both #-style and underlined (Setext) headings count. A cell's level is the level of the highest heading in it.

Requirements

VS Code 1.80 or later. Works with any notebook that has markdown cells, such as Jupyter .ipynb files.

License

MIT. Includes marked (MIT), see vendor/marked-LICENSE.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft