README file from
GithubOutline Level Fold
An Obsidian plugin that folds and unfolds the active note's outline to a chosen depth — "fold to level 1, 2, 3 …" the way OmniOutliner, Workflowy, and Dynalist do. Obsidian's core folding is otherwise all-or-nothing plus a per-node toggle; this plugin fills the gap so you can move through large nested outlines fast.
Installation
From Obsidian: In Settings → Community plugins → Browse, search for "Outline Level Fold", then install and enable it.
From GitHub: Download main.js and manifest.json from the latest release into YourVault/.obsidian/plugins/outline-level-fold/, then enable the plugin in Settings → Community plugins.
Commands
Seven commands, all bindable to hotkeys under Settings → Hotkeys (search "Outline Level Fold"):
| Command | Effect |
|---|---|
| Fold to level 1 … 6 | Keep outline levels 1..N visible; collapse everything deeper |
| Unfold all (show every level) | Expand the entire outline |
Each "Fold to level N" command is absolute, not a toggle — it always lands on the same view regardless of the current fold state, so a hotkey per level lets you jump straight between depths.
Folding a selection
With text selected, the same commands act only on the selected lines instead of the whole note — so you can fold one branch or a portion of an outline and leave the rest untouched. Inside a selection, levels are relative to what you selected: the shallowest selected line is level 1, so "Fold to level 2" shows the top two tiers of the selection.
This works on any space- or tab-indented outline. It does not work inside fenced code blocks — Obsidian doesn't render folds inside a code block — so a directory tree written in a code block can't be folded this way.
Hotkeys
Recommended scheme:
Opt+Cmd+1…Opt+Cmd+6→ Fold to level 1-6Opt+Cmd+0→ Unfold all
Cmd+1-6 is tempting but commonly conflicts with other bindings, so the Opt+Cmd chord is the safer default. The Hotkeys panel flags any conflict inline.
Level indicator
A status-bar item (bottom edge of the window) shows the current outline fold depth:
Outline: L2: Uniformly folded to a level;2is the deepest level still visible.Outline: Mixed: Folds are present but uneven — a scoped or partial fold left different parts at different depths.Outline: All: Fully expanded, nothing folded.
It is computed live from the editor's fold state, so it also reflects folds you make by hand with the gutter triangles. It clears in reading mode and on notes with no outline structure.
What counts as a "level"
- A list item's indentation is its depth — a top-level bullet is level 1, an indented bullet is level 2, and so on. Indentation is read in tab-width units; tab indentation (the primary case) is exact.
- A heading's level (the count of leading
#) is its depth, on the same scale.
List indentation is the primary signal — the plugin is built for deeply nested bullet outlines — and heading-based outlines fold too.
Requirements
Enable Obsidian's core folding so the editor maintains fold state:
- Settings → Editor → Fold indent: For nested lists.
- Settings → Editor → Fold heading: For headings.
The plugin drives Obsidian's native CodeMirror fold state directly and never edits your note's text. It acts on the active note in editing or live-preview mode; in reading mode the commands do nothing.
Compatibility
Independent of the Outliner community plugin. It uses only Obsidian's core CodeMirror folding and touches none of Outliner's state, so it works the same whether Outliner is enabled or disabled, and does not conflict with it.
Security and privacy
- Drives Obsidian's native CodeMirror fold state; never reads, writes, renames, or deletes vault files
- Stores no settings and keeps no data of its own
- Does not use telemetry
- Does not make network requests
- Does not require an account or external service
- Does not include ads or paid features
Development
Built with TypeScript and bundled with esbuild.
npm install # install dev dependencies
npm run dev # watch build (writes main.js on change)
npm run build # type-check + production bundle
The @codemirror/* packages are kept external — Obsidian provides them at runtime.
Platform
Desktop only.
Credits
Built on Obsidian's native CodeMirror 6 code-folding API (@codemirror/language). The fold-state approach follows the same mechanism Obsidian uses for its own heading and list folding.
License
MIT — see LICENSE. You are free to use, modify, and redistribute it.