Code Highlighter
19th of April, 2006 (Last modified: 20th of April, 2007)
/*
Plugin Name: Code Highlighter
Version: 1.1
Plugin URI: http://hvassing.com/my-projects/code-highlighter
Description: Highlights any PHP-code that's wrapped with a code-element.
Author: Håvard Hvassing
Author URI: http://hvassing.com
*/
This plugin highlights and colour-codes all PHP-code in a post given that the PHP-code is wrapped in a code-element. This allows for easy interpretation of code that's included in a WordPress post as it uses the standard PHP colours for highlighting. The plugin only highlights text that's enclosed in a code-element and that includes a <?php-tag.
E.g.:
<code>[php] /* This is a test comment */ [/php]</code>
[php] /* This is a test comment */ [/php]
<code>< ?php /* This is a test comment */ ?></code>
< ?php /* This is a test comment */ ?>
To install the plugin simply upload it to your wp-content/plugin-directory and activate it from the WordPress administration.
Thanks to Scott Merrill for feedback and comments during development. There is also a blog post explaining how this plugin came about; http://hvassing.com/2006/code-highlighter-plugin/
Version 1.1 (Current)
- Fixed bug: Added
unserializewhen usingCSSclass-names for colour coding
Version 1.0
- Added support for custom
CSSclass-names - Added support for BBCode-style
[php]and[/php], which is translated into<?phpand?> - Added support for turning off colour-coding by the user (
?highlight=no)
Version: 0.7
- Fixed bug: Missing argument in
< ?php function highlight($code) ?>,$codeis now initialized to nothing.
Version: 0.6
- Highlights code that wraps over several lines
- Improved efficiency with initial check to see whether or not the plugin is needed
- Removes additional
< ?php - Cleans up WordPress separation of
< ?php - Added additional comments
Note:
Previous changes are excluded as they are of minor importance to the plugin.
Download
In the future (ToDo)
- Check that all elements balance
4 Responses to “Code Highlighter”
Hello,
Thanks for this plugin.
I’m using Wordpress MU with Dean’s FCKEditor For Wordpress
if I put :
[php]
/* This is a test comment */
echo “Hello”;
[/php]
i get :
What is the solution to keep the quotes ?
Thanks a lot.
1Leave a Reply