Monday, August 30, 2010

Blog spring clean

Admittedly this is late for a spring clean, but Blogger has introduced a host of updates since I last looked. One being this nifty new template.

Also, something I've wanted to try out is a decent syntax highlighter and this one looks good. See http://alexgorbatchev.com/SyntaxHighlighter/. The instructions I followed for Blogger can be found here.

So now I can easily publish code like this:

<html>
  <head>
    <title>Tutorial: HelloWorld</title>
  </head>
  <body>
    <h1>HelloWorld Tutorial</h1>
  </body>
</html>

(You have escape angular brackets)

print "Hello, World!"

// Outputs "Hello, world!" and then exits
public class HelloWorld {
   public static void main(String[] args) {
       System.out.println("Hello world!");
   }
}

Don't use the Blogger WYSIWYG editor for this, switch to HTML else it will get very confused. I have used the pre method over script. I imagine if you switch templates this may break, but a quick copy and paste should bring the functionality back.

Fingers crossed it comes out ok through RSS readers as well!