Since I’m always posting code snippets, it made sense to apply some syntax highlighting.
There’s a few different ways to achieve this depending on your preference.
For Webapps & Blogs
There’s really two ways to do it:
- Server side.
- Client side.
The only thing with Geshi, is you have to specify the language – sometimes this doesn’t suit the solution, because you just want to whack in the code and off it goes.
I’m in the process of (soft) launching a new web site jQuery for Designers which uses client side code highlighting.
It uses Google’s syntax highlighter with a few small tweaks for my own use, i.e. I’ve compressed it and changed it so it applies to all code tags regardless of the class.
I like this syntax highlighter because you don’t have to specify the language. It takes common design patterns and highlights them as appropriate, i.e. quoted strings, numbers, functions, etc.
The bottom line is syntax highlighting is used more for breaking up the code than actually picking out keywords – otherwise you’re not really reading the code :-)
Using Third Parties
Up until now, I’ve used snipplr but I’ve always wanted to do more with it.
It’s through this kind of functional requirements that I’ve started my own code bin: Todged (again, another soft launch, I’m still writing new functionality for it and it’s very much a showcase site which I’ll blog about here in detail (OpenID, automatic avatars, etc)). I’m toying with the functionality of allowing posted code blocks from Todged go directly in to a specified blog.
Can anyone else recommend any other tools/apps?