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"].
Additional support for highlighting Drupal source code is provided too.
Third party library dependency: GeSHi (version 1.0.x)
This module requires the third-party PHP library GeSHi (Generic Syntax Highlighter), which has to be downloaded separately.
Important note: only the 1.0.x branch of the GeSHi library is supported, so do not use the development branch GeSHi 1.1.x. Direct link to GeSHi 1.0.x releases: http://sourceforge.net/projects/geshi/files/geshi/
Drupal 8 Status
The module works on Drupal 8, but still need some work before a stable release, you can see the current progress at this issue.
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.
- Code filter: a simple module with support for PHP syntax highlighting
- Ajax Markup
- Compile GeSHi: compile source code snippets
- Windows Live Writer Plug-in: GeSHi Server Blocks (more info)
- Allow use of GeSHi Filter with Wysiwyg module for Drupal 7 and CKEditor (experimental module).