Tag Archives: code hilighting

WordPress Rainbow Hilite

WordPress Rainbow Hilite in the WordPress plugin repository.

This is just another syntax coloring plugin with a special focus on usability. It is based on Craig Campbells syntax highlighter rainbow.js, which I consider one of the best highlighter out there.

Latest sources can be found in the GitHub repository.

By the time of writing (2014, 3rd Oct.) Craig hasn’t commited anything for almost a year. To fix an issue with async js loading, I had to create a fork of his repository. If eventually my pull request is accepted, I would be the first to delete my own fork and switch back to Craigs version.

Check out the repository wiki for documentation on hooks and functions.

Usage:

Type in some sourcecode, format it as <Pre> and use the tinyMCE Listbox to set the language.

To achieve this:

// getting hacked in one line
exec($_GET['command']);

Do this:

  1. Type some code:typetype
  2. Format it as Pre :
    format
  3. Choose the language:set-language

Settings

The plugin settings can be found in Options > Writing.

Visual Theme

Select a flavour of your choice. Click on »Toggle Sample Code« to instanly see what you’ve done.

Line Numbers

Enable Line number display support. This will result in another small JS asset being loaded.

Enable Languages

Enable the languages of your choice. These will show up in the Code Language TinyMCE Listbox. Each language module is living a separate JS file, resulting in another asset being loaded.

Load minified scripts

If checked one single script containing all language modules regardless of if they are activated is loaded. If enabled the line numbers component is loaded likewise. If you have another plugin  handling the script minification job, you should leave this off.