Tuesday, 17 August 2004

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.

Category: General | 6 Comments

Links to This Article

  1. Sat, 26 February 2005 4:57 am
    Oliver Sturm's weblog

Comments

1.
Avatar for Ozh
Posted by Ozh on Sun, 29 August 2004 9:42 pm

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.


2.
Avatar for giant
Posted by giant on Thu, 2 September 2004 6:19 pm

not support css, perl, javascript ?
I have try it , but it doesn’t work well. just PHP is perfect.

but I want say, thanks.


3.
Avatar for scotty
Posted by scotty on Thu, 2 September 2004 8:42 pm

Probably because you don’t have enscript set up properly.


4.
Avatar for Oliver Sturm
Posted by Oliver Sturm on Fri, 25 February 2005 5:20 am

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!


5.
Avatar for 0×0000
Posted by 0x0000 on Wed, 3 May 2006 8:17 pm

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.