Tuesday 15 January 2008

Integrating SyntaxHighlighter with Blogger

I've just found a quick and easy way of integrating SyntaxHighlighter with Blogger. Go and check this blog entry and start posting coloured code snippets!

Two things to note though. If your theme uses background images for <li> elements, you will have to apply this patch to your CSS:

div.dp-highlighter li {
background-image: none;
}
Otherwise each line of your code snippets will start with a background image as it is coded with an <li> element.

Finally, if you copy and paste the whole javascript from step 2 your syntax highlighting will only support the following languages:
  • Cpp
  • CShapr
  • CSS
  • Java
  • JScript
  • Sql
  • Xml
Syntax Highlighter supports more, for example Ruby, Delphi or VB. If you want to use any of them, you can do this by adding an extra line like this (for Ruby):

<script src='http://[YOUR HOST]/shBrushRuby.js' type='text/javascript'/>

3 comments:

John Ortiz OrdoƱez said...

Hi! Thanks for this information... now I'm trying install SyntaxHighlighter on my weblog! So long!

Unknown said...

Hi dude,

I read your blog. This is a wonderful blog. I was able to get the information that I had been looking for. Thanks once again.

-
Delphi Consulting Services

Anonymous said...

top [url=http://freeonlinecasinobonus.co.uk/]blackjack[/url] brake the latest [url=http://www.casinolasvegass.com/]casino[/url] unshackled no set aside perk at the foremost [url=http://www.baywatchcasino.com/]casino perk
[/url].