As Blogger doesn't provide you any space to upload code, SyntaxHighlighter v2.0 now provides a hosted version. So to begin you need to edit the HTML layout of your blog. Enter the following before </head>:
<link href='http://alexgorbatchev.com/pub/sh/2.0.296/styles/shCore.css' rel='stylesheet' type='text/css'/>Following that add the brushes that you think you'll need, I'm using C# and SQL:
<link href='http://alexgorbatchev.com/pub/sh/2.0.296/styles/shThemeDefault.css' rel='stylesheet' type='text/css'/>
<script src='http://alexgorbatchev.com/pub/sh/2.0.296/scripts/shCore.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/2.0.296/scripts/shBrushCSharp.js' type='text/javascript'/>On the next line add the following:
<script src='http://alexgorbatchev.com/pub/sh/2.0.296/scripts/shBrushSql.js' type='text/javascript'/>
<script type='text/javascript'>The clipboard line is optional, if it's not provided the copy to clipboard icon won't display on the code window.
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.config.clipboardSwf = "http://alexgorbatchev.com/pub/sh/2.0.296/scripts/clipboard.swf"
SyntaxHighlighter.all();
</script>
Finally to add a code block use the <pre></pre> tags and provide a brush name (in this case C#):
Syntax Highlighter is donationware. If you're using it please donate to Alex.
if (!working)
{
FixIt();
return;
}

No comments:
Post a Comment