Monday, February 9, 2009

Code Listings on Blogger

I finally found a great post about inserting code listings on Blogger. They use a javascript library called syntax-highlighter.
Let's see if it works:

package freshespresso.listing;

public class List {

public static void main(String[] args) {
System.out.println("That's some high octane cup!");
}
}

Note that for Java code you would use the class="Java" and name="code" attributes on the pre element, like

<pre class="Java" name="code">
java code here...
</pre>

I love it! Here is a cup of goodness for you Mr Alex Gorbatchev :)

No comments: