Formatting source code when posting with MarsEdit 3

This blog is hosted on Squarespace.com and in general I would have to say I am happy with the service apart from a couple of minor issues. The first is that there is no easy way to optimise the site for viewing from the iPhone. No big deal but since this is a blog mostly about developing for the iPhone it is a shame.

The other issue is that it has been a real pain to post code examples. The Squarespace web UI provides a WYSIWYG interface but no real support for formatting code other than using a fixed-width font which looks pretty ugly. I want any Objective-C code I post to look the way Xcode intended it to look in all its syntax highlighted glory.

I have been experimenting with using Pygments, a python based syntax highlighter. I built a simple OS X Automator service that would convert a block of Objective-C code I had pasted into TextMate into nicely highlighted html code. I would then paste the block of html into Squarespace. The result was better than nothing but to be honest still fairly ugly.

Well yesterday MarsEdit 3.0 was released and it may be the solution to my problem. MarsEdit has been around for a while and is a much praised desktop blog posting tool for the Mac. I have tried MarsEdit in the past but it did not play well with Squarespace. I found that I always needed to go fix the post in the Squarespace web interface to correct formatting issues. (This seems to be a limitation with Squarespace rather than MarsEdit.)

New in MarsEdit 3.0 is the possibility to create posts using a rich text format. Even better the formatting is preserved when posting to Squarespace. The nice side-effect of this is that I can cut and paste code from Xcode directly into MarsEdit and it retains all of the formatting and syntax highlighting from Xcode.

You can see the result in yesterdays blog post on iPad Gestures. The sample code in the blog post looks identical to the code as it appears in Xcode.

MarsEdit has lots of other nice features but for me being able to easily post nicely formatted code is a must have. I am currently on a 30-day trial of MarsEdit 3 but so far I think I may be handing my $39.95 over to the red sweater guys at the end.

Never miss a post!

iOS Size Classes Cheat Sheet

Subscribe and get my free iOS Size Classes Cheat Sheet

Success! Now check your email to confirm your subscription and download your free guide to iOS Size Classes.

There was an error submitting your subscription. Please try again.

Unsubscribe at any time.
No time to watch WWDC videos?

Sign up to get my iOS posts direct to your inbox and I will send you a free PDF of my iOS Size Classes Cheat Sheet.

OK! Check your inbox (or spam folder) for an email to confirm your details and download your free guide to iOS Size Classes.

There was an error submitting your subscription. Please try again.

Unsubscribe at any time.
Archives Categories