I followed instructions from one of Philip Johnson's article.
Insert following lines to your
<head/> element.
<link href="http://google-code-prettify.googlecode.com/svn/trunk/src/prettify.css" rel="stylesheet" type="text/css"/>
<script src="http://google-code-prettify.googlecode.com/svn/trunk/src/prettify.js" type="text/javascript"/>
Make sure the
prettyPrint() function invoked on load of your body tag.
<body onload="prettyPrint()">
Put your source codes between
<pre><code class="prettyprint">and </code></pre>tag like follows.
<pre><code class="prettyprint linenums lang-java">/**
* A class prints \"hello, world!\".
*
* @author Jin Kwon
*/
public class Hello {
public static void main(String[] args) {
System.out.println("hello, world!");
}
}</code></pre>
Note that I had to put the first comment line("/**") to the end of the starting <pre ...>tag for the 'linenums' class works correctly.And you will get following output.
/**
* A class prints \"hello, world!\".
*
* @author Jin Kwon
*/
public class Hello {
public static void main(String[] args) {
System.out.println("hello, world!");
}
}I can't say that google-code-prettify is better than Alex Gorbatchev's SyntaxHighlighter.
Thanks for sushi! Ha!
ReplyDeleteThanks
ReplyDelete제가 삼빠군요 ^^*
ReplyDelete된장!!! 4번째이군~
ReplyDelete