Simon Palmer’s blog

March 2, 2010

Hallelujah. Code formatting in my wordpress blog!

Filed under: code — simonpalmer @ 10:15 pm

How did I not know about the Sourcecode tags? I have spent years trying to figure out how to post nice looking code to my blog and was misled by all the plug-in nonsense which only applies if you are hosting your own wordpress instance – which I’m not. Here is the link to the docs for formatting source code in your or hosted blog.

I’m a bit disappointed that there is not an HTML language definition, but that’s OK, I write XHTML in any case so XML works just fine.

function makeRooms(edit)
	var t = getTag("roomsBody", "div");
	if (t != null)
		var div = "<div id='rooms'>";
		//if (rooms === undefined) rooms = [];
		for (var i = 0; i &lt; rooms.length; i++)
			if (edit)
				div += makeRoomDivEdit(rooms[i], imgpath, i);
				div += makeRoomDiv(rooms[i], imgpath);
		div += &quot;</div>";
		if (edit) div += "<a style='padding:5px;' class='instruction' href='addRoom()'>Add Room</a>";
		t.innerHTML = div;

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a free website or blog at

%d bloggers like this: