gallery-prettify demo

HTML

<h1>Javascript</h1>
<pre class="prettyprint">
    /**
    * nth element in the fibonacci series.
    * @param n >= 0
    * @return the nth element, >= 0.
    */
    function fib(n) {
        var a = 1, b = 1;
        var tmp;
        while (--n >= 0) {
            tmp = a;
            a += b;
            b = tmp;
        }
        return a;
    }

    document.write(fib(10));
</pre>

JavaScript

YUI({
    modules: {
        'gallery-prettify': {
            fullpath: 'https://raw.github.com/derek/yui3-gallery/master/src/gallery-prettify/js/prettify.js',
            requires: ['gallery-prettify-css-sam']
        },
        'gallery-prettify-css-sam': {
            fullpath: 'http://google-code-prettify.googlecode.com/svn/trunk/src/prettify.css'
        },
        'gallery-prettify-css-night': {
            fullpath: 'http://google-code-prettify.googlecode.com/svn/trunk/styles/sunburst.css'
        }
    }
}).use('gallery-prettify', function(Y) {
    // It's loaded, now make everything pretty!
    Y.prettyPrint();
});