highlighting-kate: Syntax highlighting

[ deprecated, library, text ] [ Propose Tags ]
Deprecated. in favor of skylighting

highlighting-kate is a syntax highlighting library with support for nearly one hundred languages. The syntax parsers are automatically generated from Kate syntax descriptions (http://kate-editor.org/), so any syntax supported by Kate can be added. An (optional) command-line program is provided, along with a utility for generating new parsers from Kate XML syntax descriptions.

[Skip to Readme]


Automatic Flags

Choose the new, smaller, split-up base package.


Build the Highlight executable.


Use the pcre-light library instead of regex-pcre-builtin


Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info


Maintainer's Corner

For package maintainers and hackage trustees


  • No Candidates
Versions [RSS] 0.2, 0.2.1, 0.2.3, 0.2.4, 0.2.5,, 0.2.6,,, 0.2.7,,,, 0.2.9, 0.2.10, 0.3, 0.3.1, 0.4, 0.5,,,,,,, 0.5.1, 0.5.2, 0.5.3,,,,,,,,,, 0.5.4, 0.5.5,, 0.5.6,, 0.5.7,, 0.5.8,,,,,, 0.5.9, 0.5.10, 0.5.11,, 0.5.12, 0.5.13, 0.5.14, 0.5.15, 0.6, 0.6.1, 0.6.2,, 0.6.3, 0.6.4
Change log changelog
Dependencies base (<5), blaze-html (>=0.4.2 && <0.8), containers, filepath, highlighting-kate, mtl, parsec, pcre-light (>=0.4 && <0.5), regex-pcre-builtin (>=, utf8-string [details]
License LicenseRef-GPL
Author John MacFarlane
Maintainer jgm@berkeley.edu
Category Text
Home page http://github.com/jgm/highlighting-kate
Source repo head: git clone git://github.com/jgm/highlighting-kate.git
Uploaded by JohnMacFarlane at 2014-06-19T18:51:03Z
Distributions Debian:0.6.4, Fedora:0.6.4, FreeBSD:0.6, LTSHaskell:0.6.4, NixOS:0.6.4, Stackage:0.6.4
Executables Highlight
Downloads 120515 total (103 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Successful builds reported [all 1 reports]

Readme for highlighting-kate-

[back to package description]


A Haskell source code highlighting library, based on Kate's syntax description files (http://kate-editor.org/). It can produce both HTML and LaTeX output.

Currently, the following languages/formats are supported:

  • Actionscript
  • Ada
  • Apache
  • Asn1
  • Asp
  • Awk
  • Bash
  • Bibtex
  • Boo
  • C
  • Changelog
  • Clojure
  • Cmake
  • Coffeescript
  • Coldfusion
  • Commonlisp
  • Cpp
  • Cs
  • Css
  • Curry
  • D
  • Diff
  • Djangotemplate
  • Doxygen
  • Dtd
  • Eiffel
  • Email
  • Erlang
  • Fortran
  • Fsharp
  • Gnuassembler
  • Go
  • Haskell
  • Haxe
  • Html
  • Ilerpg
  • Ini
  • Java
  • Javadoc
  • Javascript
  • Json
  • Jsp
  • Julia
  • Latex
  • Lex
  • LiterateCurry
  • LiterateHaskell
  • Lua
  • Makefile
  • Mandoc
  • Markdown
  • Matlab
  • Maxima
  • Mediawiki
  • Metafont
  • Mips
  • Modula2
  • Modula3
  • Monobasic
  • Nasm
  • Noweb
  • Objectivec
  • Objectivecpp
  • Ocaml
  • Octave
  • Pascal
  • Perl
  • Php
  • Pike
  • Postscript
  • Prolog
  • Pure
  • Python
  • R
  • Relaxngcompact
  • Restructuredtext
  • Rhtml
  • Ruby
  • Rust
  • Scala
  • Scheme
  • Sci
  • Sed
  • Sgml
  • Sql
  • SqlMysql
  • SqlPostgresql
  • Tcl
  • Texinfo
  • Verilog
  • Vhdl
  • 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 definitions.

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).

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

git clone git://anongit.kde.org/kate

The syntax definitions can then be found in


There is information on the syntax highlighting definitions at http://docs.kde.org/stable/en/applications/kate/highlight.html. See also http://kate-editor.org/2005/03/24/writing-a-syntax-highlighting-file/.

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):