From the beginning until now, I have been displaying all my code postings
like this.
Well, I just found this awesome code syntax highlighter for all the main languages (C, C++, C#, Delphi, Java, JavaScript, PHP, Python, Ruby, SQL, VB, and XML). I’ve implemented it into this blog, and below is the first sample of code being rendered with it. It’s all javascript based, and damn simple to use.
You can get a copy of it through Google Code: Here
Here is a sample javascript function wrapped by this highlighter:
var attempts = 0;
var timerHandle = setTimeout("checkIfHilighterLoaded()", 350);
function checkIfHilighterLoaded(){
try{
dp.SyntaxHighlighter.ClipboardSwf = '/flash/clipboard.swf';
dp.SyntaxHighlighter.HighlightAll('code');
clearTimeout(timerHandle);
}
catch(e){
clearTimeout(timerHandle);
if(attempts < 25){
timerHandle = setTimeout("checkIfHilighterLoaded()", 350);
}
attempts++;
}
}
see… bad ass =)
Tags: General by .: Adam
No Comments »