As a blogger that regularly posts source code, I really feel like I should’ve known about this a long time ago. I JUST learned that WordPress.com has built-in support for code formatting, and I really couldn’t be happier. My theme selection criteria was largely based on how well code would be displayed, and now I don’t need to be limited by that — hooray!
Here’s the post with all the juicy details: http://en.support.wordpress.com/code/posting-source-code/
[sourcecode language="<language>"] your code here [/sourcecode]
// I am SO excited about this!
And here’s the quick & dirty:
- Replace <language> with the desired language to enable color-formatting (e.g., css, csharp, xml)
- If a language is not provided, “text” will be used
- Other options, like line-highlighting and line-wrapping can be controlled by optional attributes (highlight=”1,2″, wraplines=”true/false”)
- Code will be automatically encoded for display — no more finding/replacing <‘s and >’s!