lynchjames / obsidian-mind-map

An Obsidian plugin for displaying markdown notes as mind maps using Markmap.
MIT License
1.05k stars 73 forks source link

Collapsing every sub-level of the mindmap with a command #31

Open santiyounger opened 3 years ago

santiyounger commented 3 years ago

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

jawspeak commented 1 year ago

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 commented 1 year ago

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

jawspeak commented 1 year ago

I implemented this with the following 2 PRs: