Highlight Test One

// factorial(4) => 24
function factorial(i)
{
  // tail-recursive helper
  var fac_helper = function(i, acc)
  {
    if (i < 2)
      return acc;
    else
      return fac_helper(i - 1, acc * i);
  }
  return fac_helper(i, 1);
}

WHAT'S HAPPENING HERE:

The JavaScript engine in your browser is performing syntax highlighting on my code for your viewing pleasure. Ooh, look at the pretty colors! See the line numbers!

The JavaScript being run is Alex Gorbatchev's excellent SyntaxHighlighter.

HOW DID I DO THAT:

Here is the "Full HTML" used to produce the above:

<!-- Include required JS files -->
<script type="text/javascript" src="../scripts/syntaxhighlighter/scripts/shCore.js"></script>
 
<!--
    At least one brush, here we choose JS. You need to include a brush for every 
    language you want to highlight
-->
<script type="text/javascript" src="../scripts/syntaxhighlighter/scripts/shBrushJScript.js"></script>
 
<!-- Include *at least* the core style and default theme -->
<link href="../scripts/syntaxhighlighter/styles/shCore.css" rel="stylesheet" type="text/css" />
<link href="../scripts/syntaxhighlighter/styles/shThemeDefault.css" rel="stylesheet" type="text/css" />
 
<!-- You also need to add some content to highlight, but that is covered elsewhere. -->
<pre class="brush: javascript">
// factorial(4) => 24
function factorial(i)
{
  // tail-recursive helper
  var fac_helper = function(i, acc)
  {
    if (i < 2)
      return acc;
    else
      return fac_helper(i - 1, acc * i);
  }
  return fac_helper(i, 1);
}
</pre>
 
<!-- Finally, to actually run the highlighter, you need to include this JS on your page -->
<script type="text/javascript">
     SyntaxHighlighter.all()
</script>