Top
Search
Sunday
Feb262012

Stitching a shareable mindmapping workflow with Hazel, Python, and MMD

I'm a big fan of mindmaps for note taking and brainstorming. They're great for helping recall and I find that I get a lot of value out of being able to visually model a topic as I explore it. In the past I've used paper as my medium but I found it difficult to catalog and impossible to share in any meaningful way. I tried a few digital alternatives but disliked the way they bound me to a laptop. Since picking up the iPad1 I've found iThoughts HD on a recommendation from the Mac Power Users podcast. With an intuitive interface and keyboard friendly navigation iThoughts manages to feel almost as natural as working on paper. Moreover, invaluable for the purposes of this bit of workflow nerdery, it supports export to OPML and interfaces with dropbox. Together with the help of Hazel and some python stitching this means I can take notes on the iPad and have them show up seamlessly on dropbox as sharable outlines. I do the transform in two steps: first to MultiMarkdown2 and then to HTML. this is purely because I'm lazy and didn't want to handle the html transform directly but it would be pretty easy to do. There are a couple of OPML to outline converters out in the wild already, but I didn't like the end result and so built an ultra-simple one as follows:

import opml, sys

def recurse_items(list, depth=0, alt=False):
  for item in list:
    output.write("%s" % ((" " * depth * 4)))
    if not alt:
      output.write("* ")
    else:
      output.write("1. ")
    output.write("%s\n" % item.text.strip())
    if len(item) > 0:
      recurse_items(item, depth+1,True ^ alt)

outline = opml.parse(sys.argv[1])
(name,ext) = sys.argv[1].split('.')

output = open('%s.mmd' % name,'w')
output.write("%s\n\n" % outline.title)
recurse_items(outline)
output.close()

If you setup a hazel python rule for the above you get something like this:

Then you'll need a copy of MultiMarkdown installed, and another short Hazel rule:

With those both setup, here's the flow:

  1. Generate a mindmap
  2. Export to dropbox as OPML
  3. Hazel generates a MMD file in the same folder
  4. Hazel generates an HTML file with an outline of the map

From there I just share the outline when required and updates to the map move seamlessly to a sharable doc.

1 I'd expected this to be a) a toy, and b) not terribly different from a laptop. I was wrong on both counts. 2 This all probably works in plain Markdown as well