Enabling Markdown conversion in MarsEdit
  • The number one feature I've found missing in MarsEdit is the ability, not just to preview draft posts in Markdown, but actually to convert them from Markdown to HTML prior to posting them. Admittedly a number of blogging platforms now allow you natively to post in Markdown, but in WordPress it can only currently be done using the Markdown PHP plugin.

    After thinking about it, I realised this issue was easily solved by creating a separate automated process to carry out the conversion and making it accessible within the two above applications. To do this, I decided to use Automator to create an OS X Menu Service that will convert selected text in any application from Fletcher Penney’s excellent MultiMarkDown, which is a fork of MarkDown, to HTML and copy the result to the keyboard. This is almost childishly simple. You open Automator and choose the ‘Service’ template for your workflow.

    In the workflow pane, you check the ‘Replaces selected text’ box and add the conversion script of your choice choosing the ‘Run Shell Script’ action. You then add the script of your choice, with the path in which you’ve stored it, to the workflow pane. I also chose to add a command to pass on the resulting HTML to the clipboard.

    I can either use this command in my text editor, WriteRoom (or any application), then open MarsEdit and paste the resulting HTML in the editing pane. Or I can paste the MultiMarkDown text into MarsEdit, which has a Markdown preview filter, and convert the text prior to posting it.
  • Hi Donald - I am glad you found a workflow to enable this. I am still hoping to add functionality to MarsEdit at some point that would allow this kind of conversion "on the fly" before sending to the blog.
  • Hi Donald,

    If you set "Edit with" to the editor of your choice and then converted to HTML before saving, wouldn't you end up with the HTML in ME, without having to deal with Automator (assuming your text editor supports Markdown, in TextMate it's a matter of pressing Ctrl-Shift-H and the Markdown in the editor is replaced by the corresponding HTML), manual copy & paste, etc?

    Please note I might be spoiled by TextMate :)
  • I use MultiMarkdown constantly. Just before posting I press Shift-Cmd-T to switch into Rich text mode which converts all the markdown text into HTML. Then press Shift-Cmd-D to publish to blog.

    Of course, the preview window shows a live view of MMD formatted text so I know exactly where I am.

    Works the bomb.
  • Conversion on the fly would be fantastic. In the meantime, could we have an option to "Warn before sending if: Markdown not converted" in the blog settings? I keep forgetting : (

    (That's right, my forgetfulness is bad enough to drive me to emoticons.)
  • I don't think I'll add a warning because it would be hard for me to definitively detect whether there is Markdown in the post. It might be easier in the long run to just implement the ability to convert the Markdown :)
  • WordPress can support Markdown on it's own. Just disable the visual editor and install this plugin ( http://michelf.com/projects/php-markdown/ ). Then send the text to WordPress out of MarsEdit as usual and it will be converted by WordPress. See the post below for more instructions.

    http://digwp.com/2010/06/blogging-in-markdown/
Start a New Discussion

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!