Tuesday, January 27, 2009

Code syntax highlighting in blogs

After being promoted by Chris and Jambay I have finally updated my blog to support syntax highlighting to make samples easier to read. I originally followed the steps on this blog but I found that blogger would allow the URL to the .css file. This was fixed by removing most of the query string in the URL for the css:

<link href="http://8296241635750553491-a-1802744773732722657-s-sites.googlegroups.com/site/syntaxhighlightersite/Home/SyntaxHighlighter.css" rel="stylesheet" type="text/css"/>
<script language="javascript" src="http://syntaxhighlighter.googlecode.com/svn-history/r57/trunk/Scripts/shCore.js"/>
<script language="javascript" src="http://syntaxhighlighter.googlecode.com/svn-history/r57/trunk/Scripts/shBrushJava.js"/>
<script language="javascript" src="http://syntaxhighlighter.googlecode.com/svn-history/r57/trunk/Scripts/shBrushXML.js"/>
<script language="javascript">
dp.SyntaxHighlighter.BloggerMode();
dp.SyntaxHighlighter.HighlightAll('code');
</script>

1 comment:

Pannag said...

it is not working for me... i am using Safari.
Am I supposed to download the files form code.google and put in my local machine?