PHP Syntax Hilighting 1.2
Here is an updated version of my PHP Syntax Hilighting script (standalone or as WordPress plugin). It fixes the issue whether <font /> tag is used by enscript which renders the whole page non-XHTML compliant. A preg_replace() call replaces them with standard compliant <span style="..." /> XHTML code.
- Download syntax_hilight-1.2.php
Links to This Article
Comments
not support css, perl, javascript ?
I have try it , but it doesn’t work well. just PHP is perfect.
but I want say, thanks.
I made a small fix to your plugin to make it work with WordPress 1.5. The problem I found that WordPress would insert " into the output when it encountered a ". From your code in lines 133 and 134 I guess that this was different in older versions. I left those two lines in nevertheless (I guess they aren’t really needed any longer) and inserted a new line right after that:
$code = str_replace(""", '"', $code);
I hope all that formatting stuff will be alright in this comment :-) Have fun!
The links for the PHP files
http://scott.yang.id.au/file/php/syntax_hilight-1.2.php
and
http://scott.yang.id.au/file/php/syntax_hilight-1.3.php
seem to be broken (return 404) – is this plugin being supported? I had adapted your code for use on my blog, but have recently installed WordPress and would like to simply use the plugin…
Add a comment
Gravatar is used. Email address is required but will not be displayed. Please keep your comment on topic. No spamming and/or bad language. First time poster will be moderated. Scott reserves the right to delete/edit your comments.

One thing that seems to be broken in your site : category/project/syntax-hilite/ works, while category/project/syntax-hilite (no trailing slash) returns a 404.
Maybe a rewrite rule to redefine somewhere.