Syntax highlighter
This module integrates the SyntaxHighlighter Javascript Library into Drupal for source code list syntax highlighting within any Drupal contents.
Supported languages: ActionScript, Bash, C#, C++, CSS, Delphi, Diff, Groovy, Java, JavaFX, Javascript, Second Life LSL Script, Objective-C, OCaml, Perl, PHP, Plain text, PowerShell, Python, Ruby, Sql, Vb and XML/HTML, much more unofficial languages support.
Note: content must use the "Full HTML" format option. The "Filtered HTML" format does not work because it modifies class attribute format used here. See http://drupal.org/node/374441#comment-1351952
New: it's not necessary to use Full HTML format and the raw HTML <pre> tag. Filtered HTML or any restrictive format can be used. This means syntax highlighting can be in comments as well as node where Filtered HTML input format must be used.
Previously:
<pre class="OPTIONS">
program code
...
</pre>Now:
{syntaxhighlighter OPTIONS}
program code
...
{/syntaxhighlighter}Theme CSS: The Syntax Highlighter Javascript Library comes with a set of theme css files to control the look. This can be selected at 'admin/settings/syntaxhighlighter'. You can add your own theme css file as follow:
- Name your css file as 'shThemeXYZ.css' where XYZ is your theme's name, put this .css file in the syntaxhighter/styles directory along side with the built-in themes and select your theme at 'admin/settings/syntaxhighlighter'.
I18n Note: the SyntaxHighlighter display strings can be translated through Drupal's translation system. These strings are all in the .pot file in the translations directory. If you make a translation, please contribute it back in the issue queue.
New language and theme support: A new release of the SyntaxHighlighter Javascript library can have new language and theme added. Just update the new release. Then visit 'admin/settings/syntaxhighlighter' to choose the new options. New language and theme automatically show up there.
See more details and a demo of this module.
Install the Multicolumncheckboxesradios module to enhance the settings form.
Alternative:
- GeSHi: performs syntax highlight rendering on the server side, whereas this module does rendering on the client browser.
Releases
| Official releases | Date | Size | Links | Status | |
|---|---|---|---|---|---|
| 6.x-1.19 | 2009-Aug-30 | 13.5 KB | Download · Release notes | Recommended for 6.x | |
| Development snapshots | Date | Size | Links | Status | |
|---|---|---|---|---|---|
| 6.x-1.x-dev | 2009-Aug-25 | 13.49 KB | Download · Release notes | Development snapshot | |
