Tuesday, 3 July 2018

Freemind Scripting for Markdown Presentation Generation

When I was preparing for the London Tester Gathering workshop I decided to try and fix a flaw in my docmentation workflow.

The flaw was - I find it hard to have an overview of my documentation while working with Markdown. I fixed it with Freemind and a custom script.

What workflow?

Currently I use Marp and Pandoc and Pandocifier to create most of my documentation.


  • write the slides in markdown
  • process the markdown in Marp to generate slides
  • process the markdown in Pandoc (via pandocifier) to create longer documentation
But it can be hard to see an overview of my thinking or work.


Mind Maps are very good for providing an overview, but they are less good at generating Markdown.

Freemind now supports exporting to Markdown:

  • every branch is a heading
  • every note is a set of paragraphs
This works well if you are using a Mind Map as a document outline.

I don’t use the Mind Map as a document outline. I use it as a thinking tool.

Combined Domains

I realised that I could combine the two domains:

  • thinking domain with mind map
  • structured sequential markdown output for Marp
But I’d have to have something that:

  • procesesed each node in the MindMap
  • output the note text on the node
Then I can structure my thoughts however I want, and only add notes to those ‘thoughts’ which overlap into my slide domain.

Caveat: All slides need to be represented on my MindMap, and in order.

Free Mind Scripting

FreeMind has very capable Groovy scripting abilities:

I used a variant of the “Output to CSV” script in the Scripts collection to create the Markdown I needed.


import javax.swing.*;

// for cut 'n paste:
def showDialog(String text) {
    def dialog = new JDialog(ui.frame)
    dialog.setSize(350, 450)
    dialog.add(new JScrollPane(new JTextArea(text)))

def process(thisNode, childPosition) {

    def result = "";

    def note = thisNode.note;

        result += "\n" + note.plain + "\n";

    thisNode.children.each {
        result += process(it, childPosition + 1)
    return result

def result = process(node, 0);
This allowed me to have a mindmap with additional thinking information, and the output slides.

The script is also available on github

Literate Programming and a dab of Automatization

This is ‘kind of’ Literate Programming:

I tried a few tools prior to writing this script:

But they didn’t quite do what I needed. Sometimes we just need a little dab of Automatisation thinking to get what we need.

A video explaining all of this in more detail has been added to my Patreon programme.

No comments:

Post a Comment