Syntax Highlighting

Wed, Mar 2, 2011

You know, I've always loved those tiny editor-like widgets in blogs/sites when you are looking for some code inspiration on the web.

I've realized that we had to bring this funny stuff is want to have a fancy tech Blog, so I was doing some homework...

...and voila!

Now, how it's done. After little research I've found Alex Gorbatchev's SyntaxHighlighter. It's very straight forward to install and very easy to use. You can find it here.

You just have to add the js scripts to your page as stated in the instructions, and will instantly have 30 different types of highlighters, including Python, Javascript and HTML.

A little thing that is not covered under instructions is that you have add support for XRegExp, you can download it here and after that simply load it in your head section:

Out of the box, the highlighter renders code on plain white background. We've made a little tunning to use a light grey on even code lines. You just have to edit shThemeDefault.css and modify line 24 like this:

Congrats Alex for your highlighter, it's awesome!

Wondering how AI can help you?

This website uses cookies to improve user experience. Read more