GeSHi Filter

Updates:
  • A bug in the code that prevented GeSHi from being loaded when drupal is installed in a subdirectory has been fixed. DOwnload version 4.6.5 below.
  • A beta version is available for Drupal 4.7. The only real change here is the new form api
  • 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

    1. Copy the geshifilter folder to the Drupal modules/ directory, so that all files are in modules/geshifilter.
    2. Go to administer > modules, and enable the geshifilter.module
    3. 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.
    4. (optionally) Go to the input format's ordering page and rearrange the filtering chain to resolve conflicts.
    5. (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:

    1. Download GeSHi (http://qbnz.com/highlighter/)
    2. Install it somewhere where the filter can access it (like in the filter directory).
    3. Go to admin -> settings -> geshifilter to configure and enable syntax highlighting.


    song (not verified)

    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

    song (not verified)

    404 error when downloading 4.7 beta :(

    I fixed the link and it is tested. I should really pay more attention to details.

    Anonymous (not verified)

    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;

    }

    Anonymous (not verified)

    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

    Anonymous (not verified)

    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

    Anonymous (not verified)

    Will this work with drupal 5.1?

    Anonymous (not verified)

    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!

    Pierre (not verified)

    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

    donie (not verified)

    I have same problem. "code container" did not make any diference for me.

    sporting index (not verified)

    Try again? I have no problems.

    dainu zodziai (not verified)

    error

    runescape gold (not verified)

    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.

    runescape items (not verified)

    i really appreciate you let me log in rsloads, i want to know how you did that.if you like i hope you can email me .i like online games like runescape very much and i want to tell you a good news :
    i bought runescape gold from a site named

    Kız Oyunları (not verified)

    Thanx.. Good text

    Araba Oyunları

    Kral Oyun

    Anonymous (not verified)

    I tried this on my e-store site -http://www.MATERNITYSTORE.BIZ - but it didn't work so well.

    best penny stocks (not verified)

    hey nice work
    you write very well
    keep writing:)

    Çelik Kapı (not verified)

    Thank's everyone who post this.

    Çelik Kapı

    hidrofor (not verified)

    I can not download beta version??

    Hidrofor

    Buhar Kazanı (not verified)

    I will planning to use beta version, but I need some documents about it. How can I find them?

    Buhar Kazanı

    Buhar Kazanı (not verified)

    I have used beta for 2 months, this is better than before.

    Buhar Kazanı

    2.El Buhar Kazanı (not verified)

    Thank's for sharing really nice article.

    runescape money (not verified)

    Trying to be impressive!deeply wonderful here!
    runescape gold
    runescape money
    runescape money
    runescape equipment
    runescape power leveling
    runescape quest point
    runescape items
    runescape logs
    runescape accounts

    rs-sky is an professional store for runescape gold,items,money,accounts,powerleveling,questqoint,runes and some other goods with fast delivery and world class service.
    URL:www.rs-sky.com

    kız oyunları (not verified)

    I will planning to use beta version, but I need some documents about it. How can I find them?

    oyun (not verified)

    I will planning to use beta version, but I need some documents about it. How can I find them?

    Spomoney (not verified)

    Thanks for bug fixing

    site ekle (not verified)
    Anonymous (not verified)

    Looking for rare runescape items like masks,hats and godsword or some pure account like melee,ranger,magician runescape accounts from somewhere? Well to own a wearable Runescape rare item is quite a privilege these days, and a privilege that I’d imagine 99% of Runescape players won’t ever get the chance to experience. dofus itemsThe sad reality is that the prices of Runescape rare items is quickly becoming out of reach for new playersdofus kamas. Why? Well at the rate of inflation of these items it is hard to see new player being able to develop their characters to the point where they are able to earn enough runescape gold to be able to pay for such items is probably getting out of reach.But now you won’t think it’s out of reach any more,because almost all or rare runescape items could be found in rsloads.com, that place always give us a big shot.For more tips and details,just log on its site,or go to google to search for it,you will see there is no place even could beat it.HOHO~~
    If you’re saving up for a Runescape rare item then best of luck and I highly recommend you just redirect your attention to get a quick way from somewhere.

    estetik (not verified)

    Very useful information for me.

    Su Deposu (not verified)

    That's really nice, I will try beta version.

    Evden Eve Nakliyat (not verified)

    That's very nice, I'm gonna try it.

    Tüp bebek (not verified)

    I want to try the beta version.I downloaded file but I can't manage to setup.

    Evden Eve Nakliyat (not verified)

    I saw this article and decide to try beta version.

    prefabrik villa (not verified)

    thanks friend

    Meme Estetiği (not verified)

    thank you I want to try the beta version.I downloaded file but I can't manage to setup.

    oyunlar (not verified)

    I am Going To Try

    Free Lyrics
    Play Games

    earncow (not verified)

    thanks friend keep it up

    wow power leveling (not verified)

    Looking for rare wow power leveling like masks,hats and godsword or some pure account like melee,ranger,magician wow power leveling from somewhere? Well to own a wearable Runescape rare item is quite a privilege these days, and a privilege that I’d imagine 99% of Runescape players won’t ever get the chance to experience. The sad reality is that the prices of Runescape rare items is quickly becoming out of reach for new players. Why? Well at the rate of inflation of these items it is hard to see new player being able to develop their characters to the point where they are able to earn enough wow power leveling to be able to pay for such items is probably getting out of reach.But now you won’t think it’s out of reach any more,because almost all or rare wow power leveling could be found in rsloads.com, that place always give us a big shot.For more tips and details,just log on its site,or go to google to search for it,you will see there is no place even could beat it.HOHO~~
    If you’re saving up for a Runescape rare item then best of luck and I highly recommend you just redirect your attention to get a quick way from somewhere.

    Cheng Teng (not verified)

    Thanks for the Geshi filter and its installation guide.

    Really appreciate it.

    Masker (not verified)

    Geshi filter looks really good. Thanks pal.

    prefabrik ev (not verified)

    Thanks for very useful info.

    yemek tarifleri (not verified)

    Soo good goalkeeping

    bedava oyunlar (not verified)

    I Have Never used drupal bıt I will try

    YouTube news (not verified)

    Very useful information, thank you for sharing.

    Post new comment

    The content of this field is kept private and will not be shown publicly.