krl_geshiSyntaxHighlight released
Posted Feb 1, 09:05 in PHP
So – it’s finally deserving of a 0.1 release… There are still a few little teething problems but in general the krl_geshiSyntaxHighlight plugin is ready to go. For downloads, installation instructions please check out my project page for it, here.
Please leave any comments or suggestions for improvement at the bottom of this article…

I’m the author of GeSHi. Good to see you made a plugin using it :). And even better to see that you defeated the evil entity problems… the one gripe I have with syntax highlighting in my wordpress blog is that I have to encode everything first… but you seem to have gone to a lot of effort to make it easy for people, well done!
— Nigel McNie Mar 2, 05:10 #
Glad you like the plugin… I don’t think that I solved quite all of the evil entity problems yet but with Textpattern v1 hopefully coming out any day now I was going to wait until that came out before more hacking around in the textile core – hopefully they will have made notextile tags actually mean NO textile and I won’t need my hacks…
Thanks for the feedback :)
— Kelvin Mar 9, 23:02 #
— Nigel McNie Mar 10, 01:29 #
Thanks for the nudge – I’ve raised the point on the textpattern forums – hopefully in time to get a fix built into the v1 release :)
— Kelvin Mar 10, 02:56 #
You can see the results here: http://jamie.ideasasylum.com/notebook/index.php?id=9
If you view the source, you can see that the krl_geshiSyntaxHighlight tags are never replaced. I have the RC3 release.
Any ideas?
— Jamie Lawrence May 9, 16:56 #
<txp:krl_geshiSyntaxHighlight />
— Jamie Lawrence May 9, 17:06 #
It seems like you figured it out :)
On another note, glad to hear that it is working with RC3 – I am still using an a hacked RC1 and hadn’t tested with anything newer…
Hope you find the plugin useful,
Kelvin :)
— Kelvin Luck May 10, 02:06 #
I also had to hack the plugin a little bit to change the php include path since my installation on Dreamhost uses PHP as a cgi module (and it seems safer leave it that way), it can’t make use of .htaccess file to change the include path. Basically, I just put this at the start of the plugin function:
ini_set(“include_path”, ”/path/to/geshi/:.:/usr/local/lib/php” );
Also note that the instructions you give for modifying geshi.php are a little out of date (v1.06 is the latest version and the constructor has changed slightly)
I’ve also messed around a little bit to provide an option to remove the height restriction on the code box (i.e., only constrain the width of the div and let the code blocik flow down the page).
My next thought: since the notextile tag is a pain in the perverbial, it would make more sense to use the file-based highlighting. I wonder if that could be integrated with txp’s new file upload facility to make things easier? i.e., upload the code file using txp and then refer to it using the txp name/id rather than the full path. This would avoid ftp’ing files around and remember paths etc. hmmm…
— Jamie Lawrence May 10, 15:37 #
Thanks for the feedback…
Putting the ini_set in the function is probably a good idea although you could maybe make it more robust by doing:
ini_set(“include_path”, ”/path/to/geshi/:”.ini_get(“include_path”));
(untested) or something similar? Just so it doesn’t break anyone’s non-standard include paths…
Re. removing the height, this makes good sense.
And re. the notextile tag – yes, using the txp file upload capability would make sense. I’m actually a week into a 3 month trip around South America at the moment so unfortunately won’t be doing any changes myself in this time but you should feel free to and to post a link to the extended code here. Otherwise (and if the notextile tag still isn’t fixed) I’ll look into doing it when I get home…
Cheers :)
— Kelvin Luck May 11, 20:08 #
It could possibly have some bugs, but it will give you an idea of how to get around the notextile. I ‘think’ the problem was that content from plugins DO NOT get passed through textile in the first place.
view the source here
Cheers
— Justin Palmer Jun 15, 00:53 #
notextiletag:New Block Function for classTextile.php (txt)
Very amazing work Kelvin, and the hacks still apply well to the latest build.
— Jakob Heuser Sep 11, 09:42 #
Glad to hear that the plugin works more or less with the new build of TXP. I haven’t got around to updating yet but I guess I should soon. I’m guessing that they haven’t fixed the notextile not actually meaning notextile problem if the hacks are still necessary?
Thanks for posting your updated block function,
Cheers,
— Kelvin Sep 17, 21:08 #
— ThaNerd Jan 9, 11:33 #
— Kelvin Jan 9, 12:06 #
Geshi sucks. I’ve tried it five times in my life, but couldn’t run it eith different CMS’s, including wikipedia. It just doesn’t work.
Your plugin doesn’t work too. It just make the keywords appear italics. That’s all.
— Loststylus Oct 2, 21:26 #
I don’t think Geshi sucks. It works fine for me. Don’t you see highlighted code here or here?
— Kelvin Luck Oct 2, 22:45 #