Skip to main content

Post categories

  • Drupal Tips & Tricks
  • Drupal Howtos
  • Drupal Themes
  • X Twitter
  • youtube
Home
Drupal 4U
Drupal Development, Drupal Web Design, Drupal SEO
  • Home
  • Showcases
  • Services
  • Blog
  • Themes
  • About
  • Contact

Breadcrumb

  1. Home
  2. Tips and Tricks
  3. Use the Drupal module GeSHi Filter for syntax highlighting

Use the Drupal module GeSHi Filter for syntax highlighting

Tips and Tricks
December 17, 2014
Profile picture for user drupal
By drupal
  • facebook-f
  • twitter
  • envelope
  • print
16

The Drupal module GeSHi Filter offers you a convenient way to display different code on your website (php, html, css, js, etc.). The GeShi Filter module provides a filter for source code syntax highlighting for a wide range of languages. At the time of this writing the GeSHi library supports highlighting for more than 200 programming languages and configuration syntaxes.

Important notes:

  • It is highly recommended to have a look at the README.txt of the module before starting with the installation and configuration
  • To make it work properly, the "Filter processing order" within the text formats used must be fine-tuned. As it seems there is no clear answer as to why, since the elements can be very different. In our experience the elements "Convert URLs into links", "Correct faulty and chopped off HTML" and "Convert line breaks into HTML" must come after "GeSHi filter" in the listed order. As it seems "Convert line breaks into HTML (i.e. and )" should be the last entry.
  • Valuable information regarding the configuration can be found in the tutorial Highlight Code With GeSHi Filter In Drupal 7
  • Using Drupal 7.33 and GeSHi Filter 7.x-1.2 there is a problem with the configuration of languages. One can see the enabled and disabled languages, but if one tries to change them, they data isn't written to the database. Workaround: Manual editing of table drup_variable in database. Just add the entries geshifilter_language_enabled_GESHI-LANGUAGE-CODE and geshifilter_language_tags_GESHI-LANGUAGE-CODE for the GESHI-LANGUAGE-CODEs you want to enable. Use the same content/structure as for an already enabled GESHI-LANGUAGE-CODEs.
  • PROBLEMS using PRE: Major issue with this method is that all right angle brackets must be HTML escaped, eg all must be replaced with their HTML name "&lt". This will ensure correct rendering. Thus its recommended to replace PRE for example with CODE.
Use the Drupal module GeSHi Filter for syntax highlighting
Modules

Read more articles

Newer
301 redirects for your Drupal website (.htaccess file)
Older
Use the Drupal module "Empty Page" for pages that only consist of blocks
  • Log in to post comments
Profile picture for user drupal
drupal
16
1
min read
A- A+
  • facebook-f
  • twitter
  • envelope
  • print

Contact Drupal 4U

Get in touch for questions and our Drupal development, design and SEO services.

Contact Us

We aim to reply the latest within 48h.

About Drupal 4U

We are a group of Drupal designers, developers and webmasters and we launched this website to share our experience and knowledge with you. Drupal is a free software package that allows you to easily organize, manage and publish your content, with an endless variety of customization. Drupal is open source software maintained and developed by a very large community of developers and users.

  • X Twitter
  • youtube

Drupal Services

  • Drupal Web Design
  • Drupal Development
  • Drupal SEO
  • Drupal Migration

Drupal 4U

  • Services
  • Showcases
  • Themes
  • Blog
  • About

Drupal Links

  • Official Drupal Website
  • Drupal Answers
  • More Than Themes
  • Theme Forest
  • DXPR: Drupal for Marketers
2012 - 2025, Drupal 4U

Footer menu

  • Contact
Home
Drupal 4U
Drupal Development, Drupal Web Design, Drupal SEO
  • Home
  • Showcases
  • Services
  • Blog
  • Themes
  • About
  • Contact
Clear keys input element