Quick tips are random posts regarding something I discovered on my way to something bigger. They usually get longer than “quick” would imply, for which I refuse to apologize.

The table syntax in MultiMarkdown is intuitive and can be really fast to work with. Much faster than coding HTML tables, to be sure. Unless you’re pretty religious about your spacing, though, the plain text version can get out of hand pretty quickly. If only there were some way to make them pretty in one click…

You’ve already got the tools, I would imagine, but you might not have known they were there. I didn’t notice until tonight, but I don’t work with tables much in MultiMarkdown. In the “Utilities” folder of the MultiMarkdown installation there’s a Perl script that will do amazing things to messy MultiMarkdown tables. The more I play with it, the more I think that Fletcher Penney is a genius.

My advice? Make it into a System Service and use it everywhere. Just open up the file at ~/Library/Application Support/MultiMarkdown/Utilities/table_cleanup.pl in your favorite text editor. Open Automator and create a new Service, dragging the Run Shell Script action into the right panel. Set it to Perl, accept text, replace text and copy the contents of the script into the action. Save it and run it on some table text! If you’re running any of the Markdown Service Tools, you can name it “md - Clean Up Tables” and it will fit right in with your Services menu.

Play around with it, it’s pretty amazing. You can control certain aspects of the results by messing with the header rows, and it even centers text in centered columns (:----:). Thank you, Fletcher Penney.