views:

401

answers:

3

I'm looking for site similar to http://www.manoli.net/csharpformat/ that allows one to put in c# code snippet and it formats the html to post into your blog with a CSS file.

I need one that actually does this for Objective-C.

A: 

Assuming you're on a Mac, copying code from Xcode will keep the syntax coloring. Any WYSIWYG blog editor should support that.

In case your blog software isn't WYSIWYG, you can paste into TextEdit and save as HTML. It outputs pretty crappy HTML considering it's just highlighted source code, but it's nonetheless compliant HTML.

Other than that, I don't know of an online service for that.

zneak
Yeah I'm using four square and it did not save the format or the colors when I posted it. Not sure why.
Niels Hansen
A: 

I use pygments (python) to generate syntax highlight for source code examples embedded in blog.

If your entry text is just the source code it will work the same for what you are after, I tested it to highlight Objective-C as well.

I actually use markdown syntax to type plain text blog post in a file and I copy plain text code examples. Then I run the file via markdown processor, which includes pygments for highlight and store it into a file.

It's as simple as:

include markdown
html = markdown.markdown(text,['codehilite'])

See simple script at the link which just takes file name of your plain text file and creates html file.

Then I can copy/paste the code.

You have to include link or copy the css as well to get the syntax highligh but it's easy.

I do this for blogger, see example how to use markdown with pygments to do syntax highlight.

stefanB
+2  A: 

You want the GeSHi (Generic Syntax Highlighter) library. It's is excellent, has dozens of languages (including Objective-C, with the ability to automatically linkify classes/protocols to the documentation), and support for many popular CMSs (Django, WordPress, Drupal, Joomla, Mambo, etc).

If you'd like to see it in action, you can check out nearly any wiki page on our local CocoaHeads website. For example: http://cocoaheads.byu.edu/wiki/different-nslog

Dave DeLong
Here is the plug-in for Wordpress that I found.
Niels Hansen