GeSHi Filter
Updates:
GeSHi Filter is a 100% php driven syntax highlighting filter for Drupal that can highlight most common languages (55 and counting). This filter uses the GeSHi php syntax highlighting library, so anywhere you can run Drupal, you can run GeSHi.
GeSHi Filter is originally based off of codefilter and is backwards compatible. You can turn off syntax highlighting in the configuration section .
An alternative syntax highlighting filter is VIM color, which uses specific perl libraries in conjunction with vim to highlight code.
Installation
- Copy the geshifilter folder to the Drupal modules/ directory, so that all files are in modules/geshifilter.
- Go to administer > modules, and enable the geshifilter.module
- Go to administer > input formats. Click 'configure' for the
format you wish to enable geshifilter in, and check the codefilter checkbox on the next page. - (optionally) Go to the input format's ordering page and rearrange the filtering chain to resolve conflicts.
- (optionally) Edit your theme to provide a div.codeblock style for blocks of code.
If you want generic syntax highlighting you will need to do the following:
- Download GeSHi (http://qbnz.com/highlighter/)
- Install it somewhere where the filter can access it (like in the filter directory).
- Go to admin -> settings -> geshifilter to configure and enable syntax highlighting.












it's fabulous!
it would be very kind of u to make a version working with 4.7 beta.
I will be using 4.7 soon to so I will update the module for 4.7
i really appreciate you let me log in.an i want to know how you did that.if you like i hope you can email me .i like online games very much and i want to tell you a good news :
i bought runescape money from a site named runescape money yesterday.the service is excellent.so i stronly introduce it to you.there you can get cheapest runescape money .besides the delivering speed is very fast. if you like you may take a try.
404 error when downloading 4.7 beta :(
I fixed the link and it is tested. I should really pay more attention to details.
Try again? I have no problems.
I got this error (on a sourceforge project):
warning: geshifilter_menu(/var/www/drupal/modules/geshifilter/geshi/geshi.php): failed to open stream: No such file or directory in /home/groups/r/ro/rox/htdocs/drupal/modules/geshifilter/geshifilter.module on line 36.
warning: geshifilter_menu(): Failed opening '/var/www/drupal/modules/geshifilter/geshi/geshi.php' for inclusion (include_path='') in /home/groups/r/ro/rox/htdocs/drupal/modules/geshifilter/geshifilter.module on line 36.
The attached patch fixed it for me. I also removed the extra block around multi-line fragments, as it was producing a double border.
--- geshifilter.module (revision 609)
+++ geshifilter.module (working copy)
@@ -32,7 +32,7 @@
if( variable_get( 'geshi_enabled', FALSE ) == TRUE ) {
/* Parse out the current subdirectory if one exists */
$subdir = preg_replace( "@((.*)://)[^/]*@", "", $GLOBALS[base_url] );
- include_once( $_SERVER[DOCUMENT_ROOT].$subdir.'/modules/geshifilter/geshi/geshi.php' );
+ include_once(dirname(__FILE__) . '/geshi/geshi.php' );
}
} else {
$items[] = array( 'path' => 'admin/settings/geshifilter',
@@ -186,8 +186,8 @@
$geshi = new GeSHi( $text, $lang, variable_get( 'geshi_dir', $_SERVER[DOCUMENT_ROOT].'/modules/geshifilter/geshi' ).'/geshi' );
$text = "
" . $geshi->parse_code() . "";- if ($multiline)
- $text = ''. $text .'';
+ //if ($multiline)
+ // $text = ''. $text .'';
return $text;
}
I am getting the error "Cannot redeclare class geshi" from geisha/geisha.php line 158. Any ideas? Could this be caused by having multiple <code> blocks on a page? Or could geshifilter_menu in the .module file be firing more than once?
Thanks
Sorry, I should have provided more info: I'm running the 4.6.5 version under 4.6.3. Could the version mismatch be the issue? Is there a 4.6.3 version of the module that I can get? I was hoping to wait until 4.7 before upgrading since 4.6.5 was not a security release.
Thanks
I honestly do not know.... I remember getting that error once upon a time but I can't recall what I had done. I am extremely busy right now but I will try to find time to look into it.
V
I believe that I fixed that problem on my site either in CSS or in code. I will no longer be maintaining this module as it has been merged back into the Drupal source tree.
THe new official site is: http://drupal.org/node/65961
Thanks to everyone for your kinds words. I tend to be alittle lax when it comes to supporting code that I have written. As such I think it is good that it has been merged back into the drupal source. I'll be joining the project there.
Cheers,
Vince
Will this work with drupal 5.1?
Running latest version of Drupal have to download modified versions from other developers.
Would not recommend this out of date module! GeSHi support many more languages than this release!
I'm struggling to enable the overall code block style. Whatever I select in the "code container" option, I always obtain a <p> tag to embrace the highlighted (the code is highlighted correctly) and therefore the "overall code block style" is never used.
Same with the in-line styles/CSS styles option. It doesn't make any difference whichever I choose.
Am I doing anything wrong?
PHP: 5.2.1
Drupal: 5.2
Geshi: 1.0.7.20
geshifilter-5.x-1.x-dev
I have same problem. "code container" did not make any diference for me.
error
I will planning to use beta version, but I need some documents about it. How can I find them?
Buhar Kazanı
I have used beta for 2 months, this is better than before.
Buhar Kazanı
Thanks for the Geshi filter and its installation guide.
GeSHi Filter is originally based off of codefilter and is backwards compatible. You can turn off syntax highlighting in the configuration section .
thanks, looks good.
Thanks for the Geshi filter and its installation guide.
filter
I have the same error...
warning: geshifilter_menu(/var/www/drupal/modules/geshifilter/geshi/geshi.php): failed to open stream: No such file or directory in /home/groups/r/ro/rox/htdocs/drupal/modules/geshifilter/geshifilter.module on line 36.
warning: geshifilter_menu(): Failed opening '/var/www/drupal/modules/geshifilter/geshi/geshi.php' for inclusion (include_path='') in /home/groups/r/ro/rox/htdocs/drupal/modules/geshifilter/geshifilter.module on line 36.
Post new comment