Code formatting SyntaxHighlighter for blogger throws error
I'm using SyntaxHighlighter for blogger to format the code snippet I use in my blog. I followed steps given in a blog (http://c开发者_如何学Gooncise-software.blogspot.com/2010/03/enabling-syntaxhighlighter-in-blogger.html) but then it throws error on page load of my blogger post saying "Can't find brush for : CSS"
Got solution from another thread on stackoverflow
Formatting code snippets for blogging on Blogger
For others looking for a solution to this problem - Make sure you're referencing the shBrushCss.js library from within your <head></head> tag like so:
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCss.js' type='text/javascript'/>
Also, you can checkout this answer's source at http://oneqonea.blogspot.com/2012/04/how-do-i-add-syntax-highlighting-to-my.html
It's a really easy to follow blog that I wrote that covers adding syntax highlighting to your Blogger Blog from top to bottom in a few easy steps (with screenshots).
If you run a blogger blog, you can follow the following steps explained bellow to integrate the SyntaxHighlighter.
I've nicely explained: How to Add Syntax Highlighter to Blogger
I wrote in the end of template head section this:
<link href='http://alexgorbatchev.com/pub/sh/current//styles/shCore.css' rel='stylesheet' type='text/css'/>
<link href='http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css' rel='stylesheet' type='text/css'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCss.js'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPhp.js'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPython.js'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushSql.js'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushBash.js'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPlain.js'/>
<script>
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.config.clipboardSwf = "http://alexgorbatchev.com/pub/sh/current/scripts/clipboard.swf";
SyntaxHighlighter.all();
</script>
Next i wrote in my articles:
<pre class="brush:bash">
ls -al | grep .jpg
</pre>
You can example here see.
精彩评论