OliverCi / freeplane2md

Convert Freeplane mind maps into Markdown format
GNU Lesser General Public License v2.1
19 stars 3 forks source link

Apply correct indentation for multiline nodes #16

Closed balintkissdev closed 1 year ago

balintkissdev commented 1 year ago

There is a way for nodes that contain multiple lines to follow the indentation of the first line. The change also takes header level options into account too.

mindmap

Without the fix it would look like this:

# Test multiline indentation

## Header

- Subnote 1

text
  - Subsubnote 1

text
  - Subsubnote 2

text

Using the fix, the lines will follow the indentation:

# Test multiline indentation

## Header

- Subnote 1

  text
  - Subsubnote 1

    text
  - Subsubnote 2

    text

Providing the fix for HTML richcontent nodes is still a TODO though.

OliverCi commented 1 year ago

Thanks a lot @balintkissdev for this contribution! Multiline text is something I have not considered or tested, yet.

Some thoughts:

What do you think?

balintkissdev commented 1 year ago

I use LogSeq mainly, so I tried out and created a page with the same multiline content in LogSeq. The result is that LogSeq does not care about removing whitespaces on empty lines from the created Markdown file.

<!-- Whitespace test in LogSeq.md -->
- Subnote 1

  text
    - Subnote 2

      text
    - Subnote 3

      text

In the end Markdown just collapses into HTML anyway when displayed where needless whitespaces are removed. So I'm fine too with return ('\n' + indent*(level)).join(text.splitlines()).

EDIT: LogSeq goes even further by inserting hard tabs, but I would avoid that.

balintkissdev commented 1 year ago

Similar when using Obsidian.

<!-- Whitespace test in Obsidian.md -->
- Subnote 1

  text
   - Subnote 2

     text
   - Subnote 3

     text