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.

UK EVENTAttend ffconf.org 2024

The conference for people who are passionate about the web. 8 amazing speakers with real human interaction and content you can't just read in a blog post or watch on a tiktok!

For Webapps & Blogs

There's really two ways to do it:

  1. Server side.
  2. Client side.

Server Side

Geshi is one of the best ways I've come across for PHP. I'm sure there's a wealth of libraries out there for other languages.

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.

Client Side

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.

I use a snipplr wordpress plugin, combined with a custom TextMate bundle I've written, I can post to snipplr and post to my blog at the same time.

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?