Since WordPress is GPL’d I figured it was time I offered up the changes I’ve made to the site. Most are pretty hackish but they suit my needs for now.
FixPRE (1.22KB) removes the line break/paragraph formatting that WordPress automatically adds to all posts, regardless of whether the text is inside of a pre tag. Some of the later nightly builds of WordPress remove the <br /> tags that get added but they leave the <p></p> tags that it generated.
Syntax Highlighter (78.2KB) tries to add some syntax highlighting to code within pre tags. It uses the rather good and slightly modified Beautifier script to perform the highlighting. Unfortunately it likes to format code as well as add syntax highlighting so it isn’t a perfect solution. It also doesn’t like to format HTML code, the downsides of trying to combine a tool meant to format regular code and not code that has been auto-formatted by a CMS tool.
The regex’s used by both were written before I bought the book I push below so don’t think the poor regex’s in my code are caused by the book 🙂
Update: Nish figured out the fixes needed to get the syntax highlighter to reformat our already formatted code. Simply commenting out a few lines and changing a
rtrim was all that was needed. The zip file has been updated with the latest code.