The goal: post snippets of code in my blog.
The problems: First, plain-text code is hard to read - it would be nice to post code and have it appear color-coded in a manner similar to the way it looks in my IDE. Second, every time I put a simple quotation mark in my blog, WordPress turns it into a curly quotation mark. WordPress calls this "texturizing," and it applies this kind of translation to apostrophes, multiple hyphens, back-ticks, and a range of other character combos.
The solutions: Code Snippet 2.0 for syntax highlighting and "Disable wptexturize" to... well... disable that particular "feature." Code Snippet is built on top of Geshi, an excellent language syntax highlighter: JavaScript, PHP, and HTML, to name a few of the more important ones. The "Disable wptexturize" plugin is three lines from heaven, removing the texturize filter from the primary content of all blog entries.
With this combo of plugins, I can now do this in my blog...
// javascript:
var helloWorld = {
talk: function() {
alert('Hello, world!');
}
};
... and this ...
/* php: */
class HelloWorld {
public function talk() {
echo 'Hello, world!';
}
}
Nice. Remember that if you want WordPress to respect tab stops, you'll have to edit your post in HTML mode. Perhaps in the future I'll hack WordPress to make it stop removing the tab stops from my visually-styled content.


