Sohan's Blog

Living the Developer's Life

Testing the SyntaxHighlighter Scripts

For the last few months, I am on the lookout for a really good syntax highlighter that helps me to post blogs on all the programming languages in a pretty html with syntax coloring/highlighting. This one is taken from http://alexgorbatchev.com/wiki/SyntaxHighlighter

Ruby/Rails
class TestHighlighter
def my_highlighter
return "SyntaxHighlighter"
end
end

CSharp

public class TestHighlighter
{
public string MyHighlighter
{
get {return "SyntaxHighlighter";}
}
}


What did I add to my blog?



Open Edit Html and add this just before in the blog’s template



<link href="http://alexgorbatchev.com/pub/sh/current/styles/shCore.css" type="text/css" rel="stylesheet" />
<link href="http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css" type="text/css" rel="stylesheet" />
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushRuby.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushSql.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCSharp.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCss.js' type='text/javascript'/>
<script type='text/javascript'>
    SyntaxHighlighter.config.bloggerMode = true;
    SyntaxHighlighter.all();
</script>


Thanks to Ashraf for informing me about the Windows Live Writer Plugin! It will be useful for sure.

Comments

Ashif Manjur
Thank you for posting such a helpful post. The code snippet posting has been much easier with this.
Ashrafuzzaman
This is a nice plugin too
http://sourcecodeplugin.codeplex.com/
Ashrafuzzaman
Here is an alternate plugin for live writer.
http://precode.codeplex.com/
Hope you like it :)
Sohan
@Ashraf, thanks! Good to know that it helps you.
Ashrafuzzaman
This is really a nice post. I was finding difficulties implementing it in blogger. But the post helped a lot. Thanks.