Working With Code
Disclaimer: I've grown up a bit and learned a lot since this blog was started. In the beginning I took tips from the likes of John Chow and Shoemoney and tried to write titles and content for Digg and Reddit. In the end it didn't do me much good and most of it just seems silly looking back. If you're interested anyway, here's what I wrote back then, but take it with a grain of salt.
Now that I have some content, and a nice habit of writing every day, I’ve started concentrating a little more on how this blog looks, especially since the May 1st reboot is only 8 days away!
To start, since this is a blog mainly about writing some form of code or another I needed a good
way to do some syntax highlighting. My requirements were pretty simple, it should require very
little manual intervention beyond the <code><pre></pre></code>
tags,
it should support HTML, CSS, JavaScript, Java, and possibly Ruby and PHP, and line numbers would be nice.
I found all of this in the wonderful wp-syntax plug-in
by Ryan McGeary based on the
GeSHi Generic Syntax Highlighter.
Setting it up was a breeze, as usual for WordPress plug-ins, upload, unzip, and it works. Creating
the markup was also pretty simple, since all of my code blocks were already wrapped in
<code><pre></pre></code>
it was just a matter of adding the
appropriate lang
attribute to the
pre
element. I did however, run into
one minor problem, I had all of my HTML code escaped to to use <
and
>
instead of <
and >
, but one quick search and replace
in MarsEdit for each post, and that was solved as well.