Thursday, 13 February 2014

Apply SyntaxHiglighter to my Blogger template

To apply SyntaxHiglighter to my Blogger template: Go to Blogger Dashboard -> Template -> Edit HTML Right before the </body> tag, paste this:
<pre class="brush:xml">
<!-- SyntaxHighlighter starts -->
<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' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.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/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/shBrushBash.js' type='text/javascript'/>
<script language='javascript'>
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.all();
</script>
<!-- SyntaxHighlighter ends -->
</pre>

Save the template. In the Post Editor, switch to the HTML mode and paste your escaped HTML code between the tags.

Use Quick Escape to convert your HTML to escape characters.

<pre class='brush:xml'>
// HTML Code here
</pre>
The available brushes: as3, bash, csharp, coldfusion, cpp, css, diff, erlang, groovy, jscript, java, javafx, perl, php, plain, powershell, phython, ruby, scala, sql, vb, xml
Also you can follow this tutorial:
http://www.stramaxon.com/2012/07/add-syntax-highlighter-to-blogger.html
To escape HTML code:
http://accessify.com/tools-and-wizards/developer-tools/quick-escape/default.php

No comments:

Post a Comment