obsidian-mind-map icon indicating copy to clipboard operation
obsidian-mind-map copied to clipboard

Collapsing every sub-level of the mindmap with a command

Open santiyounger opened this issue 4 years ago • 3 comments

Hey, thank you so much for the excellent plug-in Would it be possible to have a command (hotkey) to collapse / fold everything in a mindmap

image

to this

image

However of course that can normally be achieved by clicking on the top level circles (in this case "1" and "2)

What I mean is being able to have everything inside the top level collapsed as well.

So that when I expand "1" and "2" the contents inside of it is also correctly folded

like this

image

Thank you so much again, being able to use your plugin is one of my favorite aspect of Obsidian

santiyounger avatar Feb 12 '21 19:02 santiyounger

I agree this would be awesome for navigating easier in a large mindmap.

This would be useful, and it seems that the underlying library markmap supports initialExpandLevel. https://markmap.js.org/docs/json-options#initialexpandlevel. Example https://markmap.js.org/repl, look at Expand all levels and Limit expand level.

Any pointers how you would want someone to contribute this @lynchjames if we sent in a PR?

I also imagine how this could be a command palette type command to fold/unfold to level X. Similar to this issue in the visual code markmind mindmap plugin https://github.com/markmap/markmap-vscode/issues/19, so implementation may be similar too.

jawspeak avatar Nov 22 '22 20:11 jawspeak

See also PR https://github.com/lynchjames/obsidian-mind-map/pull/89

jawspeak avatar Nov 22 '22 20:11 jawspeak

I implemented this with the following 2 PRs:

  • https://github.com/lynchjames/obsidian-mind-map/pull/102 (upgrade mindmap, to make the next possible)
  • folding shortcuts / commands (open to suggestions how to implement the commands, I was inspired by how visual studio code does shortcuts) https://github.com/lynchjames/obsidian-mind-map/pull/103

jawspeak avatar Nov 24 '22 07:11 jawspeak