Blog the way you like with SyntaxHighlighter

I got to tell you that I had no intention to blog today. Moreover It’s 1:30 am and I got to be deeply sleeping as I have to get early for work. well this is a lovely summer Egyptian night that pushed me to write even a small hint.

If you are a blogger you must have come through the problem of posting your own code on your blog in approximately the same format or colors you wrote it. I ran throught the same problem when tried to past some c# from Visual Studio to my wordpress post few times in the past. Sometimes I had no time to look for a solution or even was lazy enough to work around it by giving my code different color from post text to highlight it. In my last Post about C# yield statement I decided to take a break and find a good solution for this problem. when I post a piece of code I want it to be clear enough to any reader. I give a try on google and immediately drove me to Syntax Highlighter . Syntax highlighter is a great javascript utility that doesn’t depend on whatever language or technology your blog use. It supports highlighting for many languages including javascript, C#, C++, Css and much more .

Implementation is so easy, after downloading

1-unzip the file

2-upload folders “javascript and css” to your server.

3-add the required references in your page to the css and javascript files.

4- Tag the code segment you want with Pre tag with desired brush/ language you want.

You can find the simple implementation steps Detailed Here.

Then you will enjoy reading your posts the same way you wrote them.

Bookmark and Share

This entry was posted on Wednesday, April 29th, 2009 at 3:59 pm and is filed under Development. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply