Saturday, February 11, 2012

How to enable syntax highlight for code blocks in blogger

With SyntaxHighlighter, we can easily include a block of code in blogger (blogspot).
  1. First install the javascript code in your blogger.In the Design->Layout->Add a Gadget->HTML/JavaScript, enter the following code
    
     
    
    
    
    
    
    
     
    
    
    
     
    
    
    
    
    In the above example, I've chosen to use the free hosted version. You can also download and host the javascripts yourself, as described in the author's website . In the above example, I included the following brushes: Bash, JavaScript, C++, Python and LaTeX. More supported languages can be found in here.
  2. Next, to write new posts with code blocks. You can use either the <pre> tag or the <script> tag as described here .

4 comments:

Sayan Guharoy said...

Nice example.I have similar example in my blog also..have a look Syntax Highlighter

Ankit Verma said...
This comment has been removed by the author.
charly chpal said...

Easton Bell Electrical are your Melbourne based electricians, and it is our priority that
we provide you with a friendly and courteous service while being professional and well presented.
We pride ourselves on being on time and discussing with you what work suits you best. And best of all,

We Clean Up!Hampton Electrician

Lalit Sharma said...

This is nice blog to solve each and every router technical problems. Excellent work.. Please visit this link--------- Linksys Router Technical Support .

Visitors