WP Colored Coding
Brings the cool Javascript syntax highlighter Rainbow.js to your WordPress-Blog and allows you to manage code snippets independend from the text editor. IMPORTANT! – This plugin is no longer testet with PHP 5.2! Quick Start Download the plugin from this page Follow the instructions on the WordPress
Brings the cool Javascript syntax highlighter Rainbow.js to your WordPress-Blog and allows you to manage code snippets independend from the text editor.
IMPORTANT! – This plugin is no longer testet with PHP 5.2!
Quick Start
- 01Download the plugin from this page
- 02Follow the instructions on the WordPress Codex to install the plugin. By default, the plugin is ready for use after activation. Some options can be changed on Settings → Writing.
For a detailed usage manual refer to the Usage section , or – better than a thousand words – to the screenshots .
If you want to change the behaviour of the plugin see the API-Documentation
Settings
By default, the plugin is ready for use after activation. Some options can be changed on Settings → Writing.
Raw output
This option enables an additional checkbox for each codeblock of a post which allows you to disable the esc_attr() filter for that code snippet. That means, every HTML and Javascript inside this textarea will be parsed by the browser as those. So be carefull with this option.
Usage
Codeblocks
A single Codeblock is identified (in the posts context) by its name. If you don’t want to specify a name for each block, leave it empty, it will be generated automatically.
The language field is also optional. To use syntax highlighting, write in a rainbow supported language. (It will give you suggestions.) Currently these are * C * Coffeescript * C# * CSS * Go * HTML * Java * JavaScript * Lua * PHP * Python * R * Ruby * Shell * Smalltalk
Each codeblock can be placed anywhere in the text by using the shortcode [cc name="{name}"] . You can use the TinyMCE button »CC« for that.
Shortcode (in-text code)
For just a few lines of code you may want to use the shortcode like this:
[cc lang="javascript"] var str = 'Hello World'; alert( str ); [/cc]
Contribution & Bug-Report
For bug reports or ideas for new features, please use the issue tracker on gitub .
API
The following filters are provided:
- wp_cc_rainbow_themes
- wp_cc_rainbow_scripts
- wp_cc_rainbow_languages