Friday, 23 August 2013

how to code highlight in blogger or how to use syntex highlighter in blogger

In order to install & use it on Blogger, follow the below simple steps:
1) Go to your Template Layout->Download your template as a backup first

2)Now click Edit HTML for Layout & then paste the below code in your Template before your </head> tag ends. Note this is pointing to the Latest released version v2.1.364


 
 
 
 
 
 

 
 
 
 
 
 
 
 



3)Save the template & open you blog in IE & Firefox to test if
any javascript errors are reported as this might conflict with various
other embedded scripts in your template.

This completes the direct embedding of SyntaxHighlighter in your Blog. Now lets proceed how to use it in your posts:

Usage:

For SyntaxHighlighter 2.0 & above:

Any code you want to be placed & displayed using SyntaxHighlighter must be enclosed in:





-- OR --

// HTML Code here

Note that we have option of using different brushes for highlighting different type of codes..e.g. HTML/ASP/C++ etc

In order to choose the appropriate brush, following are the various
brush aliases supporting the corresponding code highlighting:

Brush nameBrush aliasesFile name
ActionScript3as3, actionscript3shBrushAS3.js
Bash/shellbash, shellshBrushBash.js
ColdFusioncf, coldfusionshBrushColdFusion.js
C#c-sharp, csharpshBrushCSharp.js
C++cpp, cshBrushCpp.js
CSScssshBrushCss.js
Delphidelphi, pas, pascalshBrushDelphi.js
Diffdiff, patchshBrushDiff.js
Erlangerl, erlangshBrushErlang.js
GroovygroovyshBrushGroovy.js
JavaScriptjs, jscript, javascriptshBrushJScript.js
JavajavashBrushJava.js
JavaFXjfx, javafxshBrushJavaFX.js
Perlperl, plshBrushPerl.js
PHPphpshBrushPhp.js
Plain Textplain, textshBrushPlain.js
PowerShellps, powershellshBrushPowerShell.js
Pythonpy, pythonshBrushPython.js
Rubyrails, ror, rubyshBrushRuby.js
ScalascalashBrushScala.js
SQLsqlshBrushSql.js
Visual Basicvb, vbnetshBrushVb.js
XMLxml, xhtml, xslt, html, xhtmlshBrushXml.js

------------------------------------------------
Above aliases can be used at: class="brush: alias" while embedding your code in the Blog.


No comments:

Post a Comment