Is the collapsed state in the metadataCache?

Do somebody know whether the collapsed/folded status is kept somewhere in the metadata or file cache? If so, where?

It ought to be stored somewhere since Obsidian remembers the fold status, if I remember correctly, across reopening of files. But where?

And do we have some exposed API to change this status?

There’s a private API that stores fold information into local storage

I hoped for a positive response, but thanks for the affirmation.

what are you hoping to do with the fold information? The creases plugin does some custom manipulation of file folds.

I’m considering to use the KanBan plugin more in the future, but I’ve got so many lanes it’s hard to keep track and focus. As such I’ve already implemented a collapse on the lanes where I’m hiding all tasks, and rotating the lane title vertically. (My current solution requires to add a tag to collapse the lane)

The idea l had was whether I could use the collapsed state of the corresponding list of tasks to also indicate a collapsed lane, and whether I could call some API function to toggle that state.

In other words I wanted to be able to programmatically toggle the fold status of a list of tasks, and then use that collapsed state to change the CSS of that lane within a KanBan board. This would also mean that if viewed as markdown the KanBan list would have nice folded lists for those I’ve chosen not to focus on.


Come to think about it, would it be possible to use query selectors to track the collapsed state, and then use the Fold less, or Fold more commands to achieve my goals?

It wouldn’t be as elegant, but maybe it’s achievable in current version of Obsidian. The most tricky part would then be to choose whether to fold less or more (after setting the cursor to the lane title line).

(Yet another idea would be to programmatically add a class to the rendered version to indicate a collapsed lane, but that wouldn’t persist to the next opening of that board)

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