Fifth Postulate

Syntax Highlighting

For the next feature for my blog I would like syntax highlighting. So the following code blocks should look pretty.

var qfs = require('promised-io/fs');
var handlebars = require('handlebars');

var config = require('./config.json');

qfs.readFile(config.TEMPLATES.index, 'utf8')
    .then(function(templateSource){
        return handlebars.compile(templateSource);
    });

The above snippet is a part of the index generation code I use for this blog.

Just for good measure I also want to include some Java code.

package nl.cois;

import java.io.IOException;
import start.Bot;
import start.Ants;
import start.Tile;
import start.Aim;

public class MyBot extends Bot {
    public static void main(String[] args) throws IOException {
        new MyBot().readSystemInput();
    }

    @Override
    public void doTurn() {
        Ants ants = getAnts();
        for (Tile myAnt : ants.getMyAnts()) {
            for (Aim direction : Aim.values()) {
                if (ants.getIlk(myAnt, direction).isPassable()) {
                    ants.issueOrder(myAnt, direction);
                    break;
                }
            }
        }
    }
}

Let's find out how they will look.