The source code highlighting was probably the first feature I was missing in WordPress. I briefly googled my options and decided it would be quicker to add the missing feature myself, since it looked pretty straightforward.
So what I did:
1. I added a hilite() function in functions-formatting.php
$text = str_replace('<? php', '<?php', $text);
'return highlight_string($matches, true); '
The first line of the function is pretty curious, I agree. I needed it because I noticed that WP is adding a space between
? before saving to the database.
2. I added call to the new function in default-filters.php
... just before this line
And it worked! Only that the highlighting itself for some reason is using the HTML font tag (God forbid!), but I believe that's server setup.
I added the filter to one more place in default-filters.php, in order to highlight source code when listing excerpts, for example category listing on an archive listing. So default-filters.php looks more like:
This entry was posted on Friday, March 11th, 2005 and is filed under WordPress. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.