Skip to main content
  • X Twitter
  • youtube
Home
Drupal 4U
Built for AI. Powered by Drupal.
  • 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
20

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
20
1
min read
A- A+
  • facebook-f
  • twitter
  • envelope
  • print

Contact Us

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

Contact Us

We aim to reply the latest within 48h.

Drupal 4U: Built for AI. Powered by Drupal.

We are a group of Drupal designers, developers and webmasters. We are Drupal experts! We provide comprehensive services that go beyond traditional web development, focusing on how AI understands, interprets, and cites your content. With our deep expertise in Drupal's architecture, we build the intelligent core of your digital presence, ensuring your brand remains authoritative and visible in a world where AI is the primary gatekeeper of information. Partner with us and let's future-proof your digital strategy together.

  • X Twitter
  • youtube

Drupal Services

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

Drupal 4U

  • Services
  • Showcases
  • Themes
  • Blog
  • About

Drupal Links

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

Footer menu

  • Contact
Home
Drupal 4U
Built for AI. Powered by Drupal.
  • Home
  • Showcases
  • Services
  • Blog
  • Themes
  • About
  • Contact
Clear keys input element