Posting source code on a WordPress.com blog

Perhaps you – like I was – are trying to post source code on your wordpress.com hosted blog but can’t get it to display properly. You’ve inserted the ‘sourcecode’ tag in HTML view, but when you hit the ‘Visual’ tab of the editor, it still comes out like this:

Perhaps you’ve already followed the instructions on this page to no avail.

As it turns out, the Visual preview feature of the editor simply doesn’t fully render your post. You need to use the ‘Preview’ button to determine whether your sourcecode tags are working:

public void WriteToConsole()
{
Debug.WriteLine("This is what you should see when you hit 'Preview'!");
}

And that’s really all there is to it. You don’t need to add a plugin or anything – it’s already available for you to use.

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s