Sunday, June 08, 2008

prettifier javascript sourcecode syntax highlighter for blogger

easy as it does not much to configure with prettifier highlighter
1.download and see the instruction here
2. copy these code and paste befor </head>

<link href='YOUR_SITE/prettify.css' rel='stylesheet' type='text/css'/>
<script src='YOUR_SITE/prettify.js' type='text/javascript'/>
3) Wrap your code and Remember to replace < with <lt; , & with &amp;
<pre class="prettyprint">
<?php
    //comment start here
    /*and can start here*/
    #and here
    class Highlighters() {
        function result($highlighter) {
            switch ($highlighter) {
               case "chili":
               default:
                  return "FTL";
               case "syntaxhighlighter":
                  return "FTW";
            }
        }
    }
 for($i=0;$i<10;$i++){
  print_r($_POST[$i])
  return true;
  return null;
 }
    $highlighters = new Highlighters();
    printf("Chili is a nice effort, but just not for me.  Chili %s", $highlighters->result("chili"));
    printf("I am going to give SyntaxHighlighter a shot.  SyntaxHighlighter %s", $highlighters->result("syntaxhighlighter"));
?>
<HTML>
<BODY onload='init();'>
TESTING HELLO WORLD
</BODY>
</HTML>
</pre>
the css is not pretty as its name but you can modify is yourself From: http://code.google.com/p/google-code-prettify/