markmap icon indicating copy to clipboard operation
markmap copied to clipboard

Support for bi-directional mindmaps

Open ilyaminati opened this issue 9 years ago • 6 comments

Does the parser assume that there's exactly one root node? It'd be nice if it would allow for a mindmap that has a root node at the center, and child nodes both left and right of the root. Here's a simple test case:

## This is h2

## And another h2

# And an h1, ouch

ilyaminati avatar Dec 27 '15 07:12 ilyaminati

If you are missing a heading at certain level it creates a blank node to preserve hierarchy. If you have multiple top-level nodes it creates extra root node to wrap them.

Your example will look like this:

image

Having nodes both on left and right from the root is not yet implemented.

dundalek avatar Dec 27 '15 11:12 dundalek

Exactly. Those two are useful heuristics, but perhaps we could relax them, and work towards nodes on left and right of root.

Where in the code are these two heuristics? It might help in the conversation.

ilyaminati avatar Dec 28 '15 07:12 ilyaminati

I think the bi-directional display is not only limited to your case but can be used generally even for proper trees. Therefore it is the matter of the rendering and not parsing.

This d3 example can be used as a start, the changes are needed in view.mindmap.js. I think the trickiest part is to come up with good heuristics how to divide nodes between two sides, so that it is reasonably balanced.

As for the two heuristics, they are located in transform.headings.js.

dundalek avatar Dec 29 '15 12:12 dundalek

Do you think it's reasonable to divide the nodes between the two sides NOT using a heuristic but instead using the order in the file? If an h2 comes before an h1, the node of the h2 goes left of the h1, otherwise it goes right.

ilyaminati avatar Dec 30 '15 07:12 ilyaminati

I just woke up.... so this might make no sense.. but if "to the left" directives are implemented, it might be nice to also add implicit rules to force "to the top", and "to the bottom", too.. no?

mralexgray avatar Jan 31 '16 12:01 mralexgray

Hi, is there any updates? Thanks

fzyzcjy avatar Aug 21 '24 10:08 fzyzcjy