27 July 2010

SyntaxHighlighter for Blogger

Did you know SyntaxHighlighter? You can insert colored code snippets on a web page using client-side javascript only. It's very simple to install to your Blogger.
Go to "Edit HTML" section, follow these steps:
Go to http://syntaxhighlighter.googlecode.com/svn/trunk/Styles/SyntaxHighlighter.css css file, select all (Ctrl + A) and copy this (Ctrl + C). Paste (Ctrl + V ) before ]]></b:skin>.
Next step, copy the following code below and paste before tag </head>:
<script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shCore.js' type='text/javascript'/>   
<script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushCpp.js' type='text/javascript'/>
<script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushCSharp.js' type='text/javascript'/>
<script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushCss.js' type='text/javascript'/>
<script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushJava.js' type='text/javascript'/>
<script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushJScript.js' type='text/javascript'/>
<script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushSql.js' type='text/javascript'/>
<script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushXml.js' type='text/javascript'/>
<script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushBash.js' type='text/javascript'/>
<script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushDelphi.js' type='text/javascript'/>
<script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushGroovy.js' type='text/javascript'/>
<script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushPhp.js' type='text/javascript'/>
<script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushPython.js' type='text/javascript'/>
<script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushRuby.js' type='text/javascript'/>
<script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushScala.js' type='text/javascript'/>
<script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushVb.js' type='text/javascript'/>
End of step, copy following code below and paste before </body>:
<script language='javascript'>
dp.SyntaxHighlighter.BloggerMode();
dp.SyntaxHighlighter.HighlightAll('code');
</script>
Finish.
To write Java code use:

<pre name="code" class="java">
....some java codes write here....
</pre>

Notice:
To write HTML code, replace < using &lt; and > using &gt;
Here's a list of supported languages and their aliases.

--
Related post:
Install IntenseDebate untuk Blogger
Menambahkan Facebook, Twitter, and Digg Button Pada Blogger atau Blogspot


Artikel ini membantu? Silahkan klik tombol like dan share
Jangan lewatkan artikel terbaru Mr Gaptek! Silahkan berlanggan dengan klik tombol like
Previous Post
Next Post

0 comments:

Silahkan tinggalkan pesan jika ada pertanyaan atau hal lainnya.