geshi2

NP_GeSHi2

Integrates GeSHi - the Generic Syntax Highlighter - into Nucleus CMS. GeSHi can highlight code from several programming languages.

General Plugin info
Current Version: v0.1
Download: Download NP_GeSHi2_v01.zip
Code: NP_GeSHi2_code
Demo: Article with highlighted code
Forum Thread: Thread 80622

Installing

Install the plugin:

  1. Unzip the file NP_GeSHi2_v01.zip and upload NP_GeSHi2.zip to your plugin directory
  2. Install the plugin in the admin area
  3. Change the options (only if you need it)

Install the GeSHi library:

The GeSHi library must be downloaded separately from the GeSHi web site: http://qbnz.com/highlighter/

If you extract the GeSHi zip file from sourceforge.net you have serveral files in a folder geshi:

-geshi
--contrib
--doc
--geshi
-geshi.php

To use GeSHI you only need to copy:

-geshi
--geshi
-geshi.php

In the subfolder --geshi are the highlight definitions for serveral programming languages.

If you don’t won’t all you can save disk space by only copy the files for the languages you need (e.g. php.php).

Options

  • Header for pre (default setting: ‘<div class=”###language###”>’)
  • Footer for pre (default setting: ‘</div>’)
  • Header for code (default setting: ‘<span class=”###language###”>’)
  • Footer for code (default setting: ‘</span>’)

How to use the plugin

GeSHi2 can hihglight code blocks with:

<pre class="languageName">...</pre>

E.g. for PHP code:

<pre class="php">...</pre>

GeSHi2 can also highlight inline code with

<code class="languageName">...</code>

E.g. for PHP code:

<code class="php">...</code>

The pre and code tags will replaced with div and span tags and the enclosed code will be highlighted with the GeSHi library.

Tips and Tricks

Change the background of the code

You can add inline styles to the surrounding div and span tags of the highlighted code. E.g. if you wan’t a grey background for the code you can use these settings:

Change the Header for pre to

<div class="###language###" style="border:solid 1px #ccc; background-color:#eee; padding:2px 4px;">

change the Header for code to

<span class="###language###" style="background-color:#eee;">

You can see the effect of these setting in the demo: Article with highlighted code.

Wishlist

Bugs

History

  • Version 0.1 2007-11-10 kg (Kai Greve - http://kgblog.de):
    • initial release
    • built with GeSHi version 1.0.7.20

Plugin Review

NP_GeSHi2 version 0.1 works with Nucleus CMS version 3.31 - 2007-11-28 kg

 
geshi2.txt · Last modified: 2007/11/28 14:22 by kg