Why can’t anything ever work as advertised?
So, I’ve written a couple of tech articles for the next couple of weeks (scheduled to publish on the next two Tuesdays) and they had a few code snippets in them. Therefore, I thought I’d find a nice way to display that code, maybe put it in a box that preserved its formatting, and if the line was too long would present a horizontal scrollbar instead of breaking the right margin or wrapping the code.
I first tried the IG:Syntax Hiliter (it frustrates me to no end that it’s not spelled “Highlighter”), which is supposed to be the first, greatest, most original plugin for WordPress that is intended for this purpose. But when I used it, it refused to present my code in a visually accurate fashion. Or, rather, it was too accurate: it converted my symbols to their ASCII equivalent and displayed boldly that this was Plain Text mode.
You could click on Plain Text and change it to HTML, which made it look nicer, but I wanted it to default to HTML. What’s more, it didn’t behave regularly; sometimes, the code would be accepted and displayed, and other times it would be stripped out and deleted. This isn’t an issue with the plugin so much as it’s an issue with WordPress, which strips PHP from blog posts as a security measure. However, when I’m trying to post PHP to give an example, that’s pretty damned annoying.
I then tried WP-CodeBox, an off-shoot of the “Hiliter” (every time I see the word spelled that way, I think it says “Hitler”) but one that seems to be preferred by a lot of people. Unfortunately, its author’s website is in Chinese or something, has major faults on it that kick me to a partial TinyMCE window, and the plugin failed completely. I couldn’t get it to do anything.
I tried 1-2 others before finally giving up. What irked me the most is that I had it looking just fine before using pre-tags and/or blockquotes, and these plugins (even when they semi-worked) looked worse. If I included code as a regular part of this blog, I would definitely find a solution (and I suspect I’d just develop it in-house using CSS, which seems far more reliable than the plugins geared towards this task), but I just don’t care anymore.