How does obsidian remember folded bullets

I like how most of the state in my Obsidian vault is clearly encapsulated in human readable text files within the vault. One thing that I have been am unable to figure out is where Obsidian stores information about bullet points and headings that have been folded. It seems to remember this pretty reliably, and across restarts (so it’s not just stored in memory). But unlike other state changes, I can find no evidence of any notes or configuration files changing.

Does anyone have any idea where this information is stored?

1 Like

After some inspection in the developer console, I found that information is stored in localStorage (Window: localStorage property - Web APIs | MDN).

localStorage[`${app.appId}-note-fold-${path}`]

path is the relative path of the note from the vault root.

Also take a look at app.foldManager, which allows easier (?) access to that information:

app.foldManager.loadPath(path)
1 Like

And as for the location in the disk (not memory), it is likely that the local storage is stored in the Local Storage folder under the global settings folder of Obsidian.

“The global settings folder” depends on your OS, see

(Maybe in a binary format, unfortunately)

Hmm… I wonder if this applies to the headings also, as that could potentially be used to pre-hide given headings, or manipulate headings/lists at given intervals or events.

I’ll need to look into this at some point. Nice findings, @ush .

2 Likes

I wonder if this applies to the headings also

Yes, I does!

that could potentially be used to pre-hide given headings, or manipulate headings/lists at given intervals or events.

I’ve been thinking about something similar for a while:

I tried app.foldManager.savePath(path, <folding I want to obtain>) followed by app.workspace.activeLeaf.view.previewMode.rerender(true), but unfortunately, nothing happened.

But as mentioned in the linked thread, a click event handler will be able to do the job, at least for headings/list items.

(I’m curious about if such an operation is possible for wider range of elements, and if so, how.)

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.