Formatting Code Snippets on Free WordPress.com Account?

I’ve got a WordPress blog on WordPress.com. When posting something I’m including some sample Java code in the <code tags, is there any way I can have this formatted better? Such as syntax highlighting and line numbers etc?

An example of what I have is here, even though I have the code tags it doesnt seem to make it any more readable than normal text

Am I limited in choices as I’ve gone for the free option?

2 s
2

wordpress.com supports code syntax-highliting.
You can read all about it here: http://en.support.wordpress.com/code/posting-source-code/

for your specific example use:

package com.jameselsey.domain;

import java.util.ArrayList;
import java.util.List;
import com.google.android.maps.GeoPoint;
import android.app.Application;

/**
* This is a global POJO that we attach data to which we
* want to use across the application
* @author James Elsey
*
*/
public class GlobalState extends Application
{
private String testMe;

public String getTestMe() {
return testMe;
}
public void setTestMe(String testMe) {
this.testMe = testMe;
}
}

Leave a Comment