PHP Markdown Extra + PHP SmartyPants Typographer Text Filter for MarsEdit

This happened over a month ago, but a really nice thing to come along was the release of “PHP Markdown Extra + PHP SmartyPants Typographer Text Filter for MarsEdit.” I still use MarsEdit 1.2.1, well, because I don’t really post enough to justify getting an update. That means some of how this works might be different. But, basically, after you put the folder in

~/Library/Application Support/MarsEdit/TextFilters

there is a formatting option to pick the new Markdown and SmartyPants filter. This means that the preview will now be run with a PHP version of SmartyPants, and the enhanced version of PHP Markdown.1

Blogger doesn’t use Markdown, or SmartyPants, so it has to be converted before being sent. For this, I’ve been using “Translate Markdown to HTML,” from Drew Thaler.2 This has been updated to 1.0.3, which I am guessing probably makes the change even easier. In order to get this to work with my newer Markdown and SmartyPants, I changed two lines.

  1. The first line, near the top, sets the variable markdownPath. Change this to

    set markdownPath to do shell script "/usr/bin/find \"" & marsEditPath & "\" -name \"PHP Markdown Extra + PHP SmartyPants\" | /usr/bin/head -n 1"
  2. The second line, near the bottom, is the line

    set processedText to do shell script ("\"" & smartypantsPath & "\"" & " " & "\"" & unprocessedPath & "\" | \"" & markdownPath & "\"")

    I changed this to

    set processedText to do shell script ("\"" & markdownPath & "\" < \"" & unprocessedPath & "\"")

    basically processing using the new Markdown/SmartyPants combo.

  1. Which for me, is most useful just to get footnotes, like this one. 

  2. Unfortunately, it looks like his hosting server is down, so for most people I suppose this is academic. 

Technorati Tags: ,


Popular posts from this blog

Xcode 3 language specification changes

MacRumors Buyers Guide