samhopwell89 downloadsA plugin that persists heading fold state across devices and sessions by embedding fold markers directly in your markdown files.
An Obsidian plugin that persists heading fold state across devices and sessions by embedding fold markers directly in your markdown files.
Obsidian stores fold state in localStorage, which means it's lost when you switch devices, reinstall the app, or use any sync tool (iCloud, Git, Obsidian Sync, etc.). Every time you open a note on a new device, all your headings are expanded.
When you fold a heading, the plugin appends %% fold %% to that line:
## My Section %% fold %%
Content hidden when folded...
## Another Section
Content always visible...
%% %% is Obsidian's native comment syntax — the marker is invisible in Reading view and syncs with your file via any tool you already use.
When you open a note, the plugin reads the markers and restores the fold state automatically. No manual steps, no separate state files.
main.js and manifest.json from the latest release<your vault>/.obsidian/plugins/obsidian-foldstate/The marker %% fold %% is appended to heading lines:
| Mode | Appearance |
|---|---|
| Source / Live Preview | ## My Heading %% fold %% |
| Reading view | My Heading (marker hidden) |
The marker only appears on headings that are currently folded. Unfolding a heading removes it automatically.
# Install dependencies
npm install
# Build in watch mode
npm run dev
# Production build
npm run build
# Run tests
npm test
To test locally, copy main.js and manifest.json to .obsidian/plugins/obsidian-foldstate/ in a test vault and enable the plugin.
Bug reports and pull requests welcome at github.com/samhopwell/obsidian-foldstate.