views:

488

answers:

2

I'm writing a Cocoa application in Objective-C, and I would like to be able to incorporate Markdown. The user will enter text in Markdown syntax, click an "export" button, and the program will output a file of XHTML.

It seems like there are a lot of options, though. I could use one of the C/C++ implementations, I could run the Perl script as a resource to my Cocoa app, I assume could use the Python implementation and the PyObjC bridge or the Perl implementation and the CamelBones or PerlObjC bridges. What would be the simplest and easiest solution? I'm not doing anything complicated like a real-time rendered preview that would require threading.

+3  A: 

You may want to check out the open-source app Macdown which I wrote (or alternatively rentzsch's Markdownlive), which incorporate this functionality as the sole purpose of the two apps.

Steven Degutis
Thank you--those are extremely helpful and simple examples.
Ellie P.
For anyone who is interested, I decided to run the Perl script as a resource in the bundle like you do in Macdown. I found that to be the simplest and easiest solution. It works for what I want to do.I assume this requires Perl to be installed on the system (which it is out of the box, I believe.)
Ellie P.
A: 

I've used peg-markdown, it's much faster than the original perl and can handle a few syntax extensions if you enable them.

Arthur