1 of 3
1
Extension: GeSHify -  a GeSHi syntax highlighting extension for EE
Posted: 30 January 2008 06:53 PM   [ Ignore ]  
Summer Student
Avatar
Total Posts:  27
Joined  01-30-2008

I was recently searching the forums and the add-on library for a syntax highlighting solution - unfortunately all I found were some dead links or some stuff in development. I ended up creating an extension based on the popular GeSHi highlighter on my own.

Features:
- intelligent caching (GeSHify will cache your highlighted source until either the source code or some settings have been modified or the source code cache hasn’t been used for a customizable period of time)

- supports switching between GeSHi 1.0 and 1.1-alpha by click

- customizable tag (in case you want to keep the original functionality of [ code ] instead of overwriting it, which is the default setting)

- HTML-argument-style settings: you can pass something like type=actionscript

- Default settings manageable using the control panel, so you don’t have to pass all arguments each time you’re pasting code

GeSHify is released under the GPL.

Interested? Read more and download the GeSHify syntax highlighting extension for Expression Engine. (yes, this link is Google-optimized wink)

If you encounter any bugs or you’d like to see a feature in the next version of GeSHify, you can either post here, comment at my blog or send me an email via the email system of the forums.

Profile
 
 
Posted: 30 January 2008 07:28 PM   [ Ignore ]   [ # 1 ]  
Summer Student
Avatar
Total Posts:  27
Joined  01-30-2008
Victor Gutierrez - 31 January 2008 12:24 AM

I think this post would go inside the Extension forum smile..

I tried to, but since I don’t have an EE license I can’t post there.

Profile
 
 
Posted: 04 March 2008 01:34 AM   [ Ignore ]   [ # 2 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  493
Joined  04-23-2006

This doesn’t seem to be getting as much response as I would have thought.

 Signature 

OLD username was jammo, NEW username is OrganizedFellow

It’s a struggle even to keep focused. This is the best of my AD/HD & GTD.
The exceptionally slow growth of my web dev projects is eclipsed by my patience, understanding and desire to learn AS MUCH AS POSSIBLE as I slowly progress.

Profile
 
 
Posted: 04 March 2008 04:08 PM   [ Ignore ]   [ # 3 ]  
Summer Student
Avatar
Total Posts:  27
Joined  01-30-2008
OrganizedFellow - 04 March 2008 06:34 AM

This doesn’t seem to be getting as much response as I would have thought.

Unfortunately - quite a lot of people were asking for it, but few actually seem to use it.
I will still try to submit it to the Add-On library to keep it available long-term. Does anybody have some experience with submitting add-ons, cause I already tried and didn’t even receive any feedback from EllisLabs.

Profile
 
 
Posted: 04 March 2008 04:12 PM   [ Ignore ]   [ # 4 ]  
Administrator
Avatar
RankRankRankRankRankRankRank
Total Posts:  11303
Joined  06-03-2002

neverpanic, we did receive your submission, but have been too heavily involved in development of 2.0 to give it a good go-through.  It’s still sitting in my “action required” mailbox, though, so never fear. :-D

 Signature 
Profile
MSG
 
 
Posted: 05 March 2008 01:07 PM   [ Ignore ]   [ # 5 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  493
Joined  04-23-2006
neverpanic - 04 March 2008 09:08 PM

Does anybody have some experience with submitting add-ons, cause I already tried and didn’t even receive any feedback from EllisLabs.

neverpanic Posted: 04 March 2008 02:08 PM

Derek Jones Posted: 04 March 2008 02:12 PM

How’s THAT for response time?!
Gosh I love this forum!

 Signature 

OLD username was jammo, NEW username is OrganizedFellow

It’s a struggle even to keep focused. This is the best of my AD/HD & GTD.
The exceptionally slow growth of my web dev projects is eclipsed by my patience, understanding and desire to learn AS MUCH AS POSSIBLE as I slowly progress.

Profile
 
 
Posted: 05 March 2008 01:24 PM   [ Ignore ]   [ # 6 ]  
Summer Student
Avatar
Total Posts:  27
Joined  01-30-2008
OrganizedFellow - 05 March 2008 06:07 PM

neverpanic Posted: 04 March 2008 02:08 PM

Derek Jones Posted: 04 March 2008 02:12 PM

How’s THAT for response time?!
Gosh I love this forum!

Definitely awesome.
I’ll try to submit the new version during the next days (there have been some changes since I submitted the extension), so don’t check it now…

Profile
 
 
Posted: 14 April 2008 07:30 AM   [ Ignore ]   [ # 7 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  305
Joined  04-12-2008

Love your plugin, have been looking for this after moving from Drupal where a pretty good GeShi module exists!

Quick question: what’s the language type for xhtml? html, xhtml and similar does not seem to work.

 Signature 

gridonic | Twitter


URL Field Extension
Required Category Extension
DC FreeForm GeoIP Extension
DC Template Manager

Profile
 
 
Posted: 14 April 2008 11:17 AM   [ Ignore ]   [ # 8 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  978
Joined  02-28-2006

JQuery offers some code highlighting plugin’s Chili is one that stands out:
http://plugins.jquery.com/project/chili
Do you think this solution is compareable better/worse?

I can’t help but think of the weLoveFood.com project when I see this.

 Signature 

Beta, beta “Baked Potato-ee”  >:)~

Profile
 
 
Posted: 14 April 2008 11:55 AM   [ Ignore ]   [ # 9 ]  
Summer Student
Avatar
Total Posts:  27
Joined  01-30-2008
peschehimself - 14 April 2008 11:30 AM

Quick question: what’s the language type for xhtml? html, xhtml and similar does not seem to work.

AFAIK GeSHi does not support XHTML (definitely a downside on GeSHi).
For languages types, check the geshi folder in GeSHi 1.0 and the geshi/languages folder in GeSHi 1.1. The types are the names of the files/folders, i.e. html4strict for GeSHi 1.0 and html for GeSHi 1.1 (don’t have any time to look into it, but that should be it)

JQuery offers some code highlighting plugin’s Chili is one that stands out:
http://plugins.jquery.com/project/chili
Do you think this solution is compareable better/worse?

jQuery seems to be an interesting way to colorize source code. The project seems nice, however more work could be done there… line numbers would be cool, aswell as user-configurable code-highlighting (e.g. I like light code on dark background, and using JavaScript you could change that on a per-user basis).
JavaScript is also the way to go if you’re concerned about server load.

Profile
 
 
Posted: 14 April 2008 04:18 PM   [ Ignore ]   [ # 10 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  305
Joined  04-12-2008

Hi panic

Thanks for your reply, that’s definitely a downside, but i think i can live with that. Other than that, it’s a wonderful plugin.

EDIT: [code type|lang=html] does not work with Geshi 1.1, it returns

[code lang=html]
and the html…

EDIT2:

Is there any other way (at the moment at least) for me to disable the keyword matching during the code highlight (I don’t like the links to the php keywords etc.) other than doing

$geshi->enable_keyword_links(false); 

in extension code itself?

 Signature 

gridonic | Twitter


URL Field Extension
Required Category Extension
DC FreeForm GeoIP Extension
DC Template Manager

Profile
 
 
Posted: 15 April 2008 05:27 AM   [ Ignore ]   [ # 11 ]  
Summer Student
Avatar
Total Posts:  27
Joined  01-30-2008
peschehimself - 14 April 2008 08:18 PM

EDIT: [code type|lang=html] does not work with Geshi 1.1, it returns

[code lang=html]
and the html…

I am using [code type=html] on my blog and it works fine… please specify either “lang” or “type”, if you specify both, one of them will be ignored. The EE coding guidelines don’t like that kind of behaviour, so expect the type attribute to be removed in further versions.

peschehimself - 14 April 2008 08:18 PM

EDIT2:
Is there any other way (at the moment at least) for me to disable the keyword matching during the code highlight (I don’t like the links to the php keywords etc.) other than doing

$geshi->enable_keyword_links(false); 

in extension code itself?

This is the only way atm, however adding new parameters isn’t that hard - I should be able to add it this week. If you want more parameters, please state which.

Profile
 
 
Posted: 15 April 2008 05:36 AM   [ Ignore ]   [ # 12 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  305
Joined  04-12-2008

I’ve specified only one, i tried both however, lang and type. “html4strict” works, “html” does not - but this is of course because the stable version only has “html4strict” and only the alpha version has the latter wink

Another thing i noticed did not work, were the delimiters. When i set these from [ and ] to < and >, it does not seem to work, but maybe i’m doing something wrong

As for the settings, the most essential for us would be:

- disable keywords (links in code)
- set start line number for a code block
- setting a language type (already implemented with type|lang attribute)

Those are the two i can think of right now, most probably the two most used.

 Signature 

gridonic | Twitter


URL Field Extension
Required Category Extension
DC FreeForm GeoIP Extension
DC Template Manager

Profile
 
 
Posted: 15 April 2008 01:51 PM   [ Ignore ]   [ # 13 ]  
Summer Student
Avatar
Total Posts:  27
Joined  01-30-2008
peschehimself - 15 April 2008 09:36 AM

I’ve specified only one, i tried both however, lang and type. “html4strict” works, “html” does not - but this is of course because the stable version only has “html4strict” and only the alpha version has the latter wink

So this problem is resolved? I just noticed that the default values that come with GeSHify were to use GeSHi 1.0 but the type “html” (HTML for GeSHi 1.1) - which obviously wouldn’t work then. This will be fixed in versions > 0.3.6.0

peschehimself - 15 April 2008 09:36 AM

Another thing i noticed did not work, were the delimiters. When i set these from [ and ] to < and >, it does not seem to work, but maybe i’m doing something wrong

Will look into this now

- disable keywords (links in code)

Will be supported in 0.3.6.0

- set start line number for a code block

This is built-in since 0.3.something, but it seems I forgot to add documentation for it. Use start=[number] meanwhile. Documentation will be updated on release of 0.3.6.0


Edit: GeSHify 0.3.6.0 has been released. Get it at the GeSHify post at my blog.
I also tried changing my GeSHify tag name and the delimiters, and I could use <> and geshify instead of [] and code.

Btw: @peschehimself: Seeing your site is partially German you can also mail me in German about any problems - as you probably noticed I’m German.

Profile
 
 
Posted: 15 April 2008 03:25 PM   [ Ignore ]   [ # 14 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  305
Joined  04-12-2008

Works, line numbers, keywords, delimiters! Perfec, thanks.

 Signature 

gridonic | Twitter


URL Field Extension
Required Category Extension
DC FreeForm GeoIP Extension
DC Template Manager

Profile
 
 
Posted: 16 April 2008 12:38 PM   [ Ignore ]   [ # 15 ]  
Sr. Research Associate
Avatar
RankRankRankRankRank
Total Posts:  2544
Joined  02-28-2008

Hello gurus,
Does this resolve the issue of how code tage is processed in EE?
I noticed that wiki and forums don’t always show all of the code….in case of wiki pages we can edit and see the full code but no so much in forum posts of other people.
eg. http://expressionengine.com/wiki/TinyMCE_and_ExpressionEngine_Integrated_File_Upload_Management/
Thanks neverpanic for this post.

 Signature 

Defeat is a state of mind; no one is ever defeated until defeat has been accepted as a reality.

Profile
 
 
Posted: 16 April 2008 12:47 PM   [ Ignore ]   [ # 16 ]  
Summer Student
Avatar
Total Posts:  27
Joined  01-30-2008
lebisol - 16 April 2008 04:38 PM

Hello gurus,
Does this resolve the issue of how code tage is processed in EE?

I don’t know about any issues in the EE code-tag, but by default GeSHify simply overwrites the behaviour of the EE-code-tag.
This is due to the nature GeSHify internally handles these posts:
1. GeSHify gets the raw text and replaces everything between valid code-tags with a marker (you could compare that marker to a pin)
2. It returns that modified text back to EE for it’s internal text parsing (where the code-tag would be handled the EE way)
3. It receives the text EE parsed and replaces the pin from step 1 with the highlighted source code.

This means for you: Yes, it _should_ resolve the issues.

Profile
 
 
Posted: 17 September 2008 07:26 AM   [ Ignore ]   [ # 17 ]  
Lab Assistant
RankRank
Total Posts:  191
Joined  01-20-2006

I’m having an issue with your plugin neverpanic. after inserting a mix of EE code and html I’m getting this error:

Parse errorsyntax errorunexpected '>' in /core/core.functions.php(637) : eval()'d code on line 90 

On my ‘view entry’ page in the CP the highlighting IS working though. When I post some html only, the error is gone. I’m using lang=html4strict.

 Signature 

buro taggetig: freelance web design from Belgium.  |  Follow me on Twitter

Profile
 
 
Posted: 17 September 2008 07:44 AM   [ Ignore ]   [ # 18 ]  
Summer Student
Avatar
Total Posts:  27
Joined  01-30-2008

Can you provide the exact code you’re using in the text field? What makes you think this error is related to GeSHify? GeSHify does not call the evaluate() function in line 635 of core/core.functions.php where the error occurs, neither does GeSHi.
Having a backtrace or at least the executed code would be nice, you could dump that by inserting the following code at line 637 of core/core.functions.php:

// dump $str into a flat file for later reference
    
$fh fopen(dirname(__FILE__).'/evaluate-dump.txt''a');
    
fwrite($fh"\n\n".date('d.m.Y H:i:s').":\n".$str);
    
fclose($fh); 

This code will create a file called evaluate-dump.txt in your core/-Directory (make sure it’s writable to the webserver). After you added this code, please reproduce the error and provide the contents of evaluate-dump.txt. Make sure to remove the added code lines after you did this.

Profile
 
 
   
1 of 3
1