Update:
This is a very old page imported from my previous blog. If there is missing content below or anything that doesn’t make sense then please check the page on my old blog.
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…
16 Comments, Comment or Ping
Hi Kelvin,
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!
March 2nd, 2005
Hi Nigel,
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 :)
March 10th, 2005
I take it you filed a bug report etc. etc. Good luck with the plugin :)
March 10th, 2005
erm… no!
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 :)
March 10th, 2005
I cannot, for the life of me, get txp to even execute the plugin!
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?
May 10th, 2005
Ah, figured it out. Should the tags be?:
<txp:krl_geshiSyntaxHighlight />
May 10th, 2005
Hi Jamie,
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 :)
May 10th, 2005
well, “working” is a relative thing… I can do the sytax highlighting but the notextile tag is still misbehaving and I don’t really want to have to hack each version of txp. However, I’m delighted that you’ve written the plugin as I was just about to start writing my own txp&GeSHi plugin.
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…
May 11th, 2005
Hi Jamie,
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 :)
May 12th, 2005
I did this a few months ago and forgot to send you the fix. I forgot what all I had to do in-order to get this to work without the notextile block, but it does work.
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
June 15th, 2005
Hey Kelvin! Wanted to let you know I got a variant of your plugin up and running (very similar, trimmed away some of the stuff I didn’t need like OL support), and ran into a small snag in the TXP 4 classTextile. For some reason, it was picking up the code as a block element. To get around this, I redid the block function to support the
notextiletag:New Block Function for classTextile.php (txt)
Very amazing work Kelvin, and the hacks still apply well to the latest build.
September 12th, 2005
Hi Jakob,
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,
September 18th, 2005
It seems upgrading to Textpattern 4.0.3 broke the plugin :o
January 10th, 2006
I haven’t upgraded my textpattern in quite a while… I’m planning to when I get a chance and then I will try to update the code in the plugin.
January 10th, 2006
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.
October 3rd, 2008
I don’t think Geshi sucks. It works fine for me. Don’t you see highlighted code here or here?
October 3rd, 2008
Reply to “krl_geshiSyntaxHighlight released”