GeSHi Filter on drupal 6
When writing articles about drupal or anything that requires code to be shown, its great to have syntax highlighting just to liven up the page.
UPDATE: Setup GeSHi on Drupal 7
Requirements:
- Drupal 6
- GeSHi Filter drupal Module http://drupal.org/project/geshifilter
- GeSHi Code http://qbnz.com/highlighter/
Step 1 Install GeSHi
Go to http://drupal.org/project/geshifilter and download the module and place it in sites/all/modules. Download the geshi library from http://qbnz.com/highlighter/ and extract the geshi folder in the zip file into sites/all/modules/geshifilter.
Right now you should have two folders:
- sites/all/modules/geshifilter (Module folder)
- sites/all/modules/geshifilter/geshifilter (geshi library folder)
Once everything has be copied over go to Administer >> Site Building >> Modules and enable the module.
Step2 Configure GeSHi
Go to Administer >> Site Configuration >> Input Filters and on your default filter click on configure.
Tick the GeSHi filter check box under filters.

Creating a story
Go to create content and click on story. If you click on “Input Filters” you'll notice the following:
From there you can see that GeSHi is enabled.
To add php code just add the following code:
Make sure you wrap all php code around the . Check out the end result.

The module also gives you a "Source code node" content type where you can paste in a bunch of code in the body and set language type via a drop down. You don't have to wrap the code wrap the tag. You would use this content type to just display code.

GeSHi Configuration options
To change any options for the module go to Administer >> Site Configuration >> GeSHi Filter.
By default the module doesn't enable all languages, to enable or disable click on the languages tab then All to view available languages.
To enable a language just tick the check box and hit save configuration.
Comments
Great work, keep it up. Very
Great work, keep it up. Very easy to understand for a peasant such has myself.
Thank you for this post. Is
Thank you for this post. Is this the same highlighting syntax as I am writing debt help code here?
Gosh!! Thank you!
Thank for this post.
I couldn't get the code snippets working with drupal. I hadn't add the tick to the "GeSHi Filter" in the input formats! Now it works! Thank you (I am using Drupal 5.19 and Geshi filter 5-x-2.8)
thank you
I learn how to use code for my sites now as I am looking for it. Your guide helps.
Thank you!
Thank you so much for the help. I had an issue where I was unable to get proper filtering with the full html filter and the geshi filter. I changed my format type to just utilize the Geshi filter and that allowed it to work for me. Here it is working! http://topcweb.com/content/exact-target-api-functions
http://topcweb.com/content/file-download-management-updater
Drupal 6.0 geshifilter module requires Geshi 1.0
Here's the latest stable:
http://sourceforge.net/projects/geshi/files/geshi/GeSHi%201.0.8.10/
Cheers,
-r
Thanks.
Thanks.
Add new comment