Canvas: Add support for maintaining state of "Fold more" and "Fold less" functions within Cards & Files

Use case or problem

When creating a Canvas to understand some new ideas (such as taking notes on a topic of study or lecture), it would be nice to reduce the amount of information displayed within a note or card that are embedded in a .canvas file.

Proposed solution

Allow the embedded note inside a .canvas file to inherit the state of the headings and lists in the original note.

For example, within the default Obsidian sandbox, consider the following note (named “Lists” embedded within a .canvas file):

Currently in Obsidian, one can open the note directly and change which lists or headings are folded/unfolded in the original note (via the “Fold less”, “Fold more”, and “Toggle fold on the current line” commands). The following is an example result of doing so:

(current view: editing)

(current view: reading)

What’s noteworthy about this is that the state of which headings & lists are folded/unfolded is already saved in Obsidian (for both the “editing” & “reading” views, and including both “Live Preview” & “Source mode” for the editing mode). This was confirmed in the Obsidian Sandbox by both

(a) closing the note and reopening it, and
(b) closing the Obsidian Sandbox vault, reopening the vault, and reopening the “Lists” note

(Note: Other Obsidian vaults remained open during this test. It’s possible this allows the state of heading/list foldings to persist, but this is just a conjecture on my part.)

Since the state already seems to be saved somewhere, this (hopefully) means it would take less refactoring of the code base to implement this feature for notes inside of a .canvas file. I’m not familiar with how “cards” are treated on the backend, so it seems possible that they may take more work to achieve a similar functionality.

Another benefit of implementing this feature is that it may address other related feature requests mentioned below.

Current workaround (optional)

The only workaround I can think of isn’t truly viable because it’d require a lot of work to change which content is hidden or simultaneously displayed. In any case, here it is:

Subpar workaround

For content within a note that one wants to hide from being displayed in the note in a .canvas file, one can extract those sections as their own note. For example, if one wanted to hide the bullet points under “Item 2” in the “Lists” note, then one could

  1. highlight “Item 2” along with its children items.
  2. right-click and select “Extract current selection…”
  3. create note based on the name of the parent item (in this case, a note named “Item 2”)
  4. look at the note embedded in the .canvas file to see a less cluttered note

This workaround is cumbersome if one changes their mind about which list items (or headings) they’d like to have hidden. Also, it’s not possible for “cards” since there isn’t a “Extract current selection…” option when right-clicking highlighted text.

Related feature requests (optional)

The following use cases may be achieved by means of preceding proposed solution:

The following are related use cases which may be partially solved with the preceding proposed solution as a workaround:

The following is a related problem but isn’t solved by the preceding proposed solution (nor does their proposed solution solve this problem):

6 Likes

Folding headings is not the same as my request to have collapsable groups of objects.

Nice - the related request of mine which you featured would ideally be able to use a hotkey to show a condensed/folded version of a canvas to get a high level view.

Agreed, this is why I placed your collapsible groups feature request as a separate 3rd group stating

The following is a related problem but isn’t solved by the preceding proposed solution (nor does their proposed solution solve this problem):

I’ll add some headings to each of the 3 sections under “Related feature requests” to make them more visually obvious. Also, I’ll add an explicit caveat (or visual formatting) to the passage you quoted since the word “may” doesn’t seem to stand out to readers. Thanks, Roy! :pray:

[EDIT]

Gah, looks like my OP is out of the time frame to make edits to it (or maybe I just lack permissions to do so?). Well, maybe this follow-up post will serve to make those parts more explicit. :crossed_fingers:

Ah, you helped me realize that I’m confused about something regarding your feature request. Would the hotkey in your feature request

(a) only toggle the currently selected note?
(b) toggle every note in the .canvas file simultaneously?
(c) toggle all notes that have been selected in the .canvas file (eg, with Shift+LeftClick) ?

If you only want the functionality of (a), then it might be afforded by this feature request. I say “might” because it’d require you to do something like this:

Where a level-1 header is linked to the title of the card (one of my templates does this automatically for any new note I make). This approach would probably only get your functionality when you don’t have a bunch of visible frontmatter in your template (like I do with date of creation YYYYMMDDHHmm, “Status”, and “Tags” preceding the level-1 header)

Forgot to explicitly state that this would have the hotkey functionality for whatever hotkeys you’ve assigned for “Fold less”, “Toggle fold on the current line”, or “Fold all headings and lists”.

(Preceding message is now outside of the edit time frame :expressionless:)

So I actually think mindnode has the gold standard for this. There’s a hotkey for:

  • Fold current node
  • Unfold/fold one level
  • Fold all nodes

I’d even love to include only a portion of a note in my canvas. Maybe selectable by the section header?

I am taking notes using lists. In these lists, I often insert screenshots and fold them.
But on the board, everything is displayed unfold, which makes it difficult to navigate in my notes on canva.
I check Obsidian multiple times every day for this feature - please add the ability to fold lists in canva. For notetakers like me, this is a must have.

2 Likes