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?
After some inspection in the developer console, I found that information is stored in
Window: localStorage property - Web APIs | MDN).
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:
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
Obsidian stores your notes as Markdown-formatted plain text files in a vault. A vault is a folder on your local file system, including any subfolders. Because notes are plain text files, you can use …
(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,
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:
As for live preview, I know we can fold/collapse a range of lines using CodeMirror 6’s
foldService. But how can we do the same thing in reading view?
I searched the docs, and asked on Discord but got no luck. I appreciate it if someone could help me. Thanks!
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.