Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A syntax highlighting library in Haskell, based on Kate syntax definitions

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 Text
Octocat-spinner-32 css Css: Look for spans inside code class="sourceCode", not pre. January 29, 2011
Octocat-spinner-32 xml
Octocat-spinner-32 .gitignore gitignore December 09, 2010
Octocat-spinner-32 BUGS
Octocat-spinner-32 Highlight.hs
Octocat-spinner-32 LICENSE Initial commit. February 02, 2008
Octocat-spinner-32 Makefile
Octocat-spinner-32 ParseSyntaxFiles.hs
Octocat-spinner-32 README
Octocat-spinner-32 Setup.lhs Initial commit. February 02, 2008
Octocat-spinner-32 changelog
Octocat-spinner-32 highlighting-kate.cabal
highlighting-kate is a Haskell source code highlighting library, based
on Kate's syntax description files (

Currently, the following languages/formats are supported:

- Actionscript
- Ada
- Apache
- Asn1
- Asp
- Awk
- Bash
- Bibtex
- Boo
- C
- Changelog
- Cmake
- Coffeescript
- Coldfusion
- Commonlisp
- Cpp
- Cs
- Css
- D
- Diff
- Djangotemplate
- Doxygen
- Dtd
- Eiffel
- Email
- Erlang
- Fortran
- Fsharp
- Gnuassembler
- Go
- Haskell
- Haxe
- Html
- Ilerpg
- Ini
- Java
- Javadoc
- Javascript
- Json
- Jsp
- Latex
- Lex
- LiterateHaskell
- Lua
- Makefile
- Mandoc
- Matlab
- Maxima
- Mediawiki
- Metafont
- Mips
- Modula2
- Modula3
- Monobasic
- Nasm
- Noweb
- Objectivec
- Objectivecpp
- Ocaml
- Octave
- Pascal
- Perl
- Php
- Pike
- Postscript
- Prolog
- Python
- R
- Relaxngcompact
- Rhtml
- Ruby
- Scala
- Scheme
- Sci
- Sed
- Sgml
- Sql
- SqlMysql
- SqlPostgresql
- Tcl
- Texinfo
- Verilog
- Vhdl
- Xharbour
- Xml
- Xorg
- Xslt
- Xul
- Yacc
- Yaml

To install, use the cabal tool:

    cabal install

Note:  If you have checked out the source from the darcs repository,
you will first need to do:

    make prep

which generates some of the needed source files from xml syntax

If you get a linking error with GHC 7 on Mac OS X, "scattered reloc r_address
too large for inferred architecture i386," the workaround is to use the flag
`--disable-library-for-ghci` when you `cabal install`.

To generate the documentation:

    cabal haddock

For an example of the use of the library, see Highlight.hs.
To compile this program along with the library, specify the 'executable'
flag in the configure step above:

    cabal install -fexecutable

To run Highlight, specify the language name using -s:

    Highlight -s haskell Highlight.hs > example.html

If you don't specify a language name, Highlight will try to guess it
from the file extension.  Highlight can also be used as a pipe, reading
input from STDIN.  For other options,

    Highlight --help

Styling is done using span tags.  The Highlight program will include
default styles in the generated HTML, unless a link to a CSS file is
provided using the '--css' option. Some sample CSS files can be found
in the css directory. These use generic class names (Normal, Keyword,
DataType, DecVal, BaseN, Float, Char, String, Comment, Function, Others,
Alert, Error). For more fine-grained highlighting, users may wish to
create their own CSS files that use language-specific classes.

The parsers in Text/Highlighting/Kate/Syntax were automatically generated
from the Kate syntax definitions in the xml directory. You may modify
the xml files in this directory, or add new ones, and then regenerate
the parsers by doing:

    make prep


    runghc ParseSyntaxFiles.hs xml

Note that ParseSyntaxFiles.hs requires the HXT package (>= 9.0.0). If you
added or removed a syntax definition, you will also need to
update the Extra-Source-Files and Exposed-Modules sections of
highlighting-kate.cabal before recompiling using 'cabal install'.

To get the current Kate syntax highlighting files, clone the kate

    git clone git://

The syntax definitions can then be found in


There is information on the syntax highlighting definitions at

Thanks are due to all the authors of these syntax definitions.

Changes have been made to the following xml files (the originals have
been left in the directory, with .bkp extensions):

- javascript.xml:  Fixed regex \s* (which matches empty string) by changes to DetectSpaces
- perl.xml:  Fixed regexes - needed backslash-escapes before ] and ^
- bash.xml: Changed "\\" to "\" in two Detect2Char rules in FindString

NOTE: Known bugs are recorded in the file BUGS. Please send bug reports (or
better, patches) to the author (jgm at berkeley dot edu).

Something went wrong with that request. Please try again.