Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I set up a syntax highlighter on Blogger? [closed]

How do I set up a syntax highlighter on Blogger's new interface? I did try with many options but nothing has worked. Please give any suggestions.

like image 952
Anil Avatar asked Apr 26 '12 14:04

Anil


People also ask

How do you highlight a code on Blogger?

Step1) First of all, Visit the Blogger.com dashboard. Step2) Now go to the Theme Section. Step3) In Theme Section Customize, go to the Edit HTML. Step4) Search in blogger ]]></b:skin> tag via CTRL + F & Paste this Before The ]]></b:skin> tag.


2 Answers

1. First, take backup of your blogger template
2. After that open your blogger template (In Edit HTML mode) & copy the all css given in this link before </b:skin> tag
3. Paste the followig code before </head> tag

<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> 

4. Paste the following code before </body> tag.

<script language='javascript'> dp.SyntaxHighlighter.BloggerMode(); dp.SyntaxHighlighter.HighlightAll('code'); </script> 

5. Save Blogger Template.
6. Now syntax highlighting is ready to use you can use it with <pre></pre> tag.

<pre name="code"> ...Your html-escaped code goes here... </pre>  <pre name="code" class="php">     echo "I like PHP"; </pre> 

7. You can Escape your code here.
8. Here is list of supported language for <class> attribute.

like image 191
Mahesh Meniya Avatar answered Nov 28 '22 20:11

Mahesh Meniya


Checkout http://oneqonea.blogspot.com/2012/04/how-do-i-add-syntax-highlighting-to-my.html

It's a really easy "SyntaxHighlighter for Blogger" tutorial with screenshots and everything.

You should be up and running in only a few minutes.

Also, the tutorial is built around the "new interface" you're referring to.

Hope this helps. Happy coding.

like image 42
John Erck Avatar answered Nov 28 '22 21:11

John Erck