Pasting Source Code in WordPress.com Posts

I’ve always used the <pre> and <code> tags to show code in WordPress posts. This isn’t very good because the formatting always goes wrong because the lines don’t wrap automatically. Today, I discovered that some other bits of code causes WordPress to close the block and then screw up the display of all subsequent lines.

A bit of Googling led to a solution. Turns out that this is actually a common enough problem to be properly supported in WordPress.com. All you have to do is to use the ‘sourcecode’ shortcode. See the link below for instructions.

http://en.support.wordpress.com/code/posting-source-code/

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