GeSHi Filter for syntax highlighting
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 releases | Date | Size | Links | Status | |
|---|---|---|---|---|---|
| 6.x-1.2 | 2009-Feb-23 | 80.1 KB | Download · Release notes | Recommended for 6.x | |
| 5.x-2.8 | 2008-Jun-02 | 61.35 KB | Download · Release notes | Recommended for 5.x | |
| Development snapshots | Date | Size | Links | Status | |
|---|---|---|---|---|---|
| 6.x-1.x-dev | 2009-Jul-04 | 88.46 KB | Download · Release notes | Development snapshot | |
| 5.x-2.x-dev | 2009-Jan-05 | 65.19 KB | Download · Release notes | Development snapshot | |

