Experimental project

This is a sandbox project, which contains experimental code for developer use only.

This Drupal module is a unobtrusive input filters which enables syntax highlighting of source code snippets. The module uses the very popular google-code-prettify JavaScript library to do the highlighting.

Prettify works unobtrusively with other input filters, adding the necessary CSS classes to all <pre> and <code> tags in the node. This makes it very easy to switch away from Prettify again, since none of the original node content is changed.

REQUIREMENTS

INSTALLATION

  1. Download and install as usual, see Installing contributed modules (Drupal 7) for more details.
  2. Go to the google-code-prettify download page and download the minified source files (e.g. prettify-small-1-Jun-2011.tar.bz2) and unpack the downloaded file into your sites/all/libraries (or sites/sitename/libraries) folder.

    The downloaded compressed file should contain a folder named google-code-prettify that contains the minified source files e.g. prettify.js and prettify.css.

    The folder structure should look like this when you are done:
    sites/all/libraries/google-code-prettify with prettify.js and prettify.css inside it, along with any lang-*.js files you decide to include.

  3. Go to Text formats (admin/config/content/formats) and enable Prettify for the text formats you want to enable it for.
  4. (Optional) Go to the google-code-prettify themes page and download a different stylesheet and rename it to prettify.css (to override the default prettify.css that comes with the library) and include that in your theme.

Project information

  • Created by egil on , updated