GeSHi Filter for syntax highlighting

GeSHi filter

The GeShi Filter module provides a filter for source code syntax highlighting for a wide range of languages.

Source code can be entered with for example <code type="java">...</code> or <blockcode language="python">...</blockcode>. Starting from version 5.x-2.0 it is also possible to define your own generic and language specific tags (e.g. <java>) or to work with square bracket style tags (e.g. [python]). Automatically adding line numbers is possible too with for example [ruby linenumbers="normal"].

This module requires the third-party PHP library GeSHi (Generic Syntax Highlighter) (1.0.x branch). At the time of this writing this library supports highlighting for the following languages: ABAP, ActionScript, Ada, Apache Log, AppleScript, ASM, ASP, AutoIt, Bash, BlitzBasic, bnf, C, C (Mac), CAD DCL, CAD Lisp, CFDG, ColdFusion, C++, C++ (QT), C#, CSS, D, Delphi, Diff, DIV, DOS, dot, Eiffel, Fortran, FreeBasic, genero, GML, Groovy, Haskell, HTML, Uno Idl, INI, Inno, Io, Java, Java(TM) 2 Platform Standard Edition 5.0, Javascript, LaTeX, Lisp, Lua, Motorola 68000 Assembler, Matlab M, mIRC Scripting, Microchip Assembler, MySQL, NSIS, Objective C, OCaml, OpenOffice.org Basic, Oracle 8 SQL, Pascal, per, Perl, PHP, PL/SQL, Python, QBasic/QuickBASIC, Rails, Microsoft Registry, robots.txt, Ruby, SAS, Scheme, sdlBasic, Smalltalk, Smarty, SQL, TCL, Text, thinBasic, T-SQL, Visual Basic, vb.net, VHDL, Visual Fox Pro, Winbatch, XML, X++, ZiLOG Z80 Assembler. Additional support for highlighting Drupal source code is provided too.

History

The 4.7.x-1.x branch is based on the original GeSHi filter module by Vincent Filby. The 5.x-1.x branch is a basic port of this version for Drupal 5.

In the 5.x-2.x branch the GeSHi filter got a major overhaul. Main features/changes: configurable code block tags, per language tags (e.g. <java>), a submodule for a GeSHi source code node type, easier administration UI, guided filter conflict solving, and many bug fixes.

Related modules/alternatives

  • Code filter: a simple module with support for PHP syntax highlighting
  • Syntax Highlighter uses a Javascript library to add syntax highlighting client side (unlike GeSHi filter, which renders the highlighted code server side).
  • Chili highlighter also uses a Javascript library to do the syntax highlighting client side.
  • Ajax Markup

Releases

Official releasesDateSizeLinksStatus
6.x-1.22009-Feb-2380.1 KBRecommended for 6.xThis is currently the recommended release for 6.x.
5.x-2.82008-Jun-0261.35 KBRecommended for 5.xThis is currently the recommended release for 5.x.
Development snapshotsDateSizeLinksStatus
6.x-1.x-dev2009-Jul-0488.46 KBDevelopment snapshotDevelopment snapshots are automatically regenerated and their contents can frequently change, so they are not recommended for production use.
5.x-2.x-dev2009-Jan-0565.19 KBDevelopment snapshotDevelopment snapshots are automatically regenerated and their contents can frequently change, so they are not recommended for production use.


 
 

Drupal is a registered trademark of Dries Buytaert.