google-code-prettify syntax hightlight

<!-- For Syntax Highlighting -->
<script src="//code.jquery.com/jquery-latest.min.js"></script>
<link rel="stylesheet" type="text/css" href="//google-code-prettify.googlecode.com/svn/trunk/src/prettify.css"></link>  
<script src="//google-code-prettify.googlecode.com/svn/trunk/src/prettify.js"></script>  
<script>
    function styleCode() {
        if (typeof disableStyleCode != 'undefined') { return; }

        var a = false;
        
        $('code').each(function() {
            if (!$(this).hasClass('prettyprint')) {
                $(this).addClass('prettyprint');
                a = true;
            }
        });

        if (a) { prettyPrint(); } 
    }

    $(function() {styleCode();});
</script>

css
<style type='text/css'>
pre {
  padding: 2px;
  border: 1px solid #808080;
  margin: 0.5em 1em;
  padding: 0.3em 0.5em;
  background-color: rgb(230, 230, 230);
  font: 11px Courier,monospace;
  overflow: auto;
}
code {
  margin: 0em;
  padding: 0em;
}
xmp {
  margin: 0em;
  padding: 0em;
}
</style>

댓글

이 블로그의 인기 게시물