I was doing some planning with OmniOutliner yesterday. I haven’t used it for over two years but decided it was a good fit for the task I had to do. Once I had created my outline I decided I wanted to add it to my Trunk Notes personal wiki.
Excitedly I saw a plugin for OmniOutliner to do exactly that – http://fletcherpenney.net/multimarkdown/. After a little playing I was impressed by all the features and the information available on the site and in the user’s guide. However the opml2mmd tool only included the first column. My reason for using OmniOutliner was the support for multiple columns.
OmniOutliner can export in a variety of formats. One of the simplest is Plain Text with tabs. This includes all the columns and even the column headings. Five minutes later I had a little Python script which easily handles my OmniOutliner document and converts it into sensibly formatted Markdown. I want columns two and above to appear as a bulleted list underneath the heading.
Here is an example OmniOutliner document (not the one I was working with, but it has the same format):
As you can see I have three columns, and have included a note. I now export the document in the format Plain Text (with tabs) and run my Python script. Here is the resulting Markdown:
The Python script is very quick and dirty (no error handling or proper command line arguments):
#!/usr/bin/env python """ Convert an export OmniOutliner (plain text with tabs) document to Markdown @author: Matthew Kennard <email@example.com> """ import sys outline_path = sys.argv lines = open(outline_path).readlines() column_headings = lines.strip().split('t') for line in lines[1:]: # Get number of tabs at the start tabs = 0 for c in line: if c != 't': break tabs += 1 # Remove the tabs line = line.strip('t') if line.startswith('- '): # A branch line = line[2:] line = line.strip() if not line: continue columns = line.split('t') print '%s %s' % ('#' * (tabs + 1), columns) print for i, column_heading in enumerate(column_headings[1:]): column_n = i + 1 if column_n < len(columns): print ' * %s: %s' % (column_headings[column_n], columns[column_n], ) print else: # A note print line.strip()
I’m now happy that I can export my OmniOutliner planning documents and have them available on my iPhone in Trunk Notes.
The beauty of open formats (such as plain text or OPML which OmniOutliner also supports) is the ease with which you can convert your data for use in other applications. If you use Trunk Notes with other applications let me know!