text processing utilities

Highlight Dokumentation

Highlight integration

Scripting examples

See the examples/ (or extras/) subdirectory in the highlight source directory for some example scripts in PHP, Perl and Python which invoke highlight and retrieve its output as string. These scripts may be used to develop plug-ins for other applications.

Pandoc

PP macros file and tutorial are located in extras/pandoc.
See README.html for usage instruction and example files as reference.

SWIG interface

SWIG is a tool to generate interfaces for more than 10 programming languages, inluding Python, Perl, Java and C#.

The highlight package includes a SWIG interface file highlight.i (located in extras/swig) which contains all information to generate wrapper code for the highlight::CodeGenerator class. The output module gives you access to the highlight parser from within your favorite (scripting) language.

Module compilation

These are the basic steps to create a python module:

TCL interface

The extension in extras/tcl provides these functions in the highlight namespace: html, tex, latex, xterm256, truecolor, ansi, bbcode, pango

tclsh example

% load tclhighlight.so
% ::highlight::html "int main()"

Serendipity plug-in

Installation

Usage

Paste the following in the code section of the blog editing form:

[highlight lang=c]#include 

int main (void){
  printf("This is some random code");
  return 0;
} [/highlight]

Wordpress plug-in

Installation

Usage

Paste the following in the code section of the blog editing form:

<pre lang="c">#include <stdio.h>

int main (void){
  printf("This is some random code");
  return 0;
}</pre>

Use the lang parameter to define the programming language (c, php, py, xml, etc).
See the highlight.php file for some formatting options (line numbering, code indentation, line wrapping etc).

Gitweb

Append the following line to /etc/gitweb.conf:

$feature{'highlight'}{'default'} = [1];

For some reasons a second file extension mapping exists in webgit.cgi.
For most of the supported file types, /usr/lib/cgi-bin/gitweb.cgi needs to be adjusted according to highlight's filetypes.conf:

   our %highlight_ext = (
     # add new entries or extend existing ones here
     map { $_ => 'php' } qw(php3 php4 php5 phps),
   );

Configure webgit and highlight without root privileges

LyX editor

Gunnar Lindholm has written a tutorial how to integrate highlight in LyX to dynamically insert sourcecode in documents.

Mac OS X Quicklook

QLColorCode

Total Commander

TC Lister plugin

Tupel7