Monday, 14 July 2014

How to add syntax highlighter to blogger blog

You might have seen that when you disable right click and disable text selection in your blog then if yiu post some code or some type of text that you want users to be able to copy, and don't allow them to copy other things then what you all need is syntax highlighter. Syntax highlighter is a fully functional self contained code syntax highlighter which is developed in javascript. The syntax highlighter will allow users to copy the code inside it just by clicking the copy button inside it , if they want to print that code then, they can also print it and they will be able to copy and print the code inside syntax highlighter only , not all the content in page. So it is very useful to install it in your blog and here is how you can do it.
  1. Go to blogger and login in your account, then in blogger open the blog in which you want to add syntax highlighter.
  2. Then in the left side click on template editor.

  3. In the template editor press CTRL + F (to open find box) , then in find box type ]]><b:/skin>

  4. Then paste the following code just below that code.
  5. click to get code
  6. Click save template option.

How to use syntax highlighter
  1. Whenever you want to add syntax highlighter to your blog post, then switch to HTML mode in post editor.
  2. In HTML editor wherever you want to add syntax highlighter paste the following code
  3. Add the code here
  4. Replace Add code here with the code which you want to appear in syntax highlighter

  5. Click publish option and view that post, you will see that your code will appear in syntax highlighter.