Source Code is a module for Drupal 7 that defines a Source Code node type. Nodes of this type are intended to contain source code: their data is composed of a programming language (from a list of over 200 languages) and the actual lines of code, as a raw block of plain text. Upon rendering nodes of this type, the source code is syntax-highlighted using GeSHi. A typical use of this module is to combine it with Advanced Entity Tokens and Token Filter to allow the insertion of source code snippets directly into more descriptive posts.
The Source Code module requires the following:
Make sure that the latest stable version of the libraries module is installed on your Drupal 7 website. You then have to get the latest version of the GeSHi library and extract it into your sites/all/libraries folder. If the folder does not exist, create it. The top-level folder of the library must have the path sites/all/libraries/geshi. The Source Code module will inform you about installation problems in the reports panel.
Go to Administration » Modules » Source Code » Configuration (admin/config/content/source_code
), and select:
For technical reasons, the Source Code package is split into two modules. Both should be uninstalled separately to remove the whole package.
The Source Code module must be disabled and uninstalled first. This will delete the Source code content type. Existing source code nodes will be preserved without their programming language and may be deleted manually.
It will then become possible to disable and uninstall the Source Code Programming Languages module as soon as there are no fields pending for deletion in the database. Purging fields pending for deletions happens when the cron runs.
When uninstalling the Source Code module, some PHP notices related to the comment module may appear. This is due to a Drupal core bug and would be fixed eventually in a future update of Drupal.
However, these notices do not prevent the module from uninstalling and the Source code content type to be deleted.
To demonstrate syntax-highlighting capabilities provided by the module, several sample Source code nodes are available.