How to add Syntax Highlighter in blogger blog

It was confusing to me when I tried to add Syntax Highlighter in my blog because I failed most of the time. Adding syntax highlighter in blogger blog is not really a very awful task but it seems to be awful for you when you follow incomplete tutorial. I got rid of this problem by following a simple tutorial. In this portion I will try to provide you proper guideline to add syntax highlighter in your blogger blog.

To add html, css, java or any other code snippet in the post, bloggers like to use syntax highlighter. There's lot of syntax highlighter but I like this following syntax highlighter most because it is really easy to use in blogger post. 

Steps to add syntax highlighter in your blogger post

It is really an easy task. We can follow some steps before playing with blogger syntax highlighter.

At first take a backup for your blogger template. It is important. If unwanted error occurs after applying syntax highlighter code, you can go back to the original template.

Then go to the edit html mode. You will see the whole code of your template. Just try to search this keyword </head>. When you get this keyword, just before that paste the following code.

<script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shCore.js' type='text/javascript'></script>
<script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushCpp.js' type='text/javascript'></script>
<script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushCSharp.js' type='text/javascript'></script>
<script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushCss.js' type='text/javascript'></script>
<script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushDelphi.js' type='text/javascript'></script>
<script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushJava.js' type='text/javascript'></script>
<script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushJScript.js' type='text/javascript'></script>
<script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushPhp.js' type='text/javascript'></script>
<script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushPython.js' type='text/javascript'></script>
<script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushRuby.js' type='text/javascript'></script>
<script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushSql.js' type='text/javascript'></script>
<script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushVb.js' type='text/javascript'></script>
<script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushXml.js' type='text/javascript'></script>
It is almost done.

Now you have to add some javascript in your template body tag. Paste the following code before the enclosing body tag </body>. Here is the java script code.

<script language='javascript'>
dp.SyntaxHighlighter.BloggerMode();
dp.SyntaxHighlighter.HighlightAll('code');
</script>
Save your blogger template. Now it's time to test our blogger syntax highlighter.

How to use syntax highlighter in your blogger post

You have to use pre tag like this <pre> </pre>. Lets see the practical example:


<pre name="code" class="java">
your java code goes here.....
</pre>

Which language support blogger syntax highlighter

This blogger syntax highlighter supports most of the language. You can use c, c++, java, javascript and many more. Here is the list of languages that supports this syntax highlighter.
Supported Languages Link
So guys it is really an easy task. If you will get any problems with this, you can ask your problems. I will try to help you to use syntax highlighter in your blogger post. Thanks.

Comments

Popular posts from this blog

How to construct a B+ tree with example

How to show only month and year fields in android Date-picker?

Visitor Counter Script Using PHP