How to turn indented list to markdown?

I wanted to copy paste a mindmap to Notion editor.

When I copy the mindmap, I get an indented list like this.

But if I paste it in my markdown editor, it's turning out to be flat list.

So, I need to start every list item with "*" or "-" to make my Notion markdown editor to accept the nested lists.

I tried some regex search and replace like

Indented List - Mindnode Mindmap to Notion.kmmacros (2.1 KB)

Although these two regexes are working in my text editor to start every list item with "- ", not working through Keyboard Maestro.

Try this (but make sure your last entry ends with a Return:

Markdown a List Macro (v9.2)

Markdown a List.kmmacros (3.0 KB)


After exploring this problem a little more, I think I see the problem.

First, the regex does preserve whatever indenting was used (even a mix of tabs and spaces, as in the last two lines of the example text), applying a hypen+space before the first word of the line. Here's the output:


That improves on the OP's original regexes.

But it doesn't convert to Markdown in the two Markdown editors I tried (Texts and Obsidian). Instead, the hyphens are escaped. Which is apparently what the OP's screen shots were showing.

Sorry for the confusion. Outright prolonged applause for @ComplexPoint.

I'm getting these bullet points I don't want and losing indentations. Losing indentations for Mindnode copied text.

I don't understand your workflow.

I thought you were trying to apply Markdown list markup to indented lines.

I don't understand where you got your bulleted/hyphened lines, but you would search ^• for that and replace with nothing at all to get Markdown list format.

Hmm, is the problem that you ran the macro on the original Mindnode text (which seems like it might have been a list already) rather than the n indented Atom text?

If that doesn't help, supply the actual text you want to convert to Markdown list format.

We would probably be clearer about what the requirement actually is if the sample source were shown

as text between markdown triple backticks


or provided as a text file attachment, rather than as a graphic image.

iThoughtsX and MindNode clipboards, for example typically paste tab-indented outlines, but your graphic showס something that might, for example, be indented by double spaces ?

PS on the output side, Markdown parsers typically (See CommonMark, for example) expect each level in the the indentation of MD bullet nests to differ by four space characters exactly.

Possibly something like this ?

1 Like

Please also add what the Output should look like.

Yep, the macro you included here works like a charm! I don't know how I missed this Macro. I searched the entire forum. Thanks!

So the solution offered didn't look to me like it separated out the white space at the front from the rest of the item. That's what's needed - so an asterisk can be spliced between the white space and the rest of the line.

A related question, I'm grappling with a little right now in md2pptx development, is whether the white space created by MindNode is the right white space. (It probably is.)

I'm also wondering whether MindNode has its own native Markdown export.

and regular expressions alone may not be quite enough in a context where the unit of indentation is not known in advance.

For example, are four contiguous spaces one indent or two ? We probably need to prescan the whole outline before we can take a reliable view of that.

On the Mindnode questions:

  • There is a (whole map) Export as MD built in,
  • but for sub-trees, select and copy seems to be the only option.

(And the clipboard representation of outlines is tab-indented)

That is actually the problem I have with Markdown indentation in md2pptx. I might implement a "liberal/smart" algorithm there. But certainly allow an option of 2 / 4 spaces for 1 level of indentation. (Currently md2pptx converts tabs into 4 spaces early on.)

But if it's consistently tabs that MindNode is emitting then that is a much simpler (RegEx) problem.

You can see the approach I take in the source code of the macro linked above, essentially:

  • Identify the minimum non-zero indent in the outline
  • translate the outline to a list of (Int, String) tuples
    • (where the Int is the length of the indent preceding a particular line, divided by the minimum unit).
  • parse that sequence of indents to a tree structure, from which a new serialisation can be written.
1 Like