Sunday, August 16, 2009

Posting source code in Blogger

After posting any source code, First we make sure that the code is correct and same as the original.
For HTML or script source code, we require HTML Encoding so that blogger doesn't execute this code.

1.In the blogger,Click on Layout tab ->Edit HTML and put following things Before " </head> "

<link href='http://syntaxhighlighter.googlecode.com/svn/trunk/Styles/
SyntaxHighlighter.css' rel='stylesheet' type='text/css'/>
<script language='javascript' src='http://syntaxhighlighter.googlecode.com/
svn/trunk/Scripts/shCore.js'/>
<script language='javascript' src='http://syntaxhighlighter.googlecode.com/
svn/trunk/Scripts/shBrushCpp.js'/>

2. put following things Before " </body> "

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

3. encode (HTML Encode) your source code. for this, you can use this online HTML encoder


4. Open your compose tab & Put your updated(encoded) code between:
<pre>
….My code here…
</pre>


No comments:

About This Blog

Lorem Ipsum