Higlo is an OCaml library for syntax highlighting. Higlo could mean Highlighting in Ocaml.

The purpose of Higlo is not to provide syntax highlighting for every language, nor target every format (HTML, LaTeX, ...). It provides a simple way to support additional languages and develop the generator for the output format you need.

By now, only some input languages are supported (OCaml, XML, JSON and Graphviz/dot), and it only generates Xtmpl_rewrite.tree to highlight code in XML. Developing support for additional input languages is just a matter of writing a Ulex lexer. Supporting another output format only requires mapping values of type token.

See the OCaml lexer for an example of Higlo Ulex lexer.

Download

Higlo is hosted on Github.

Releases
  • 0.6 [2016-10-26]:
    • OCaml lexer: use same keyword level for %lwt as for other %id,
    • OCaml lexer: fix highlight of %id (% was removed except for %lwt).
  • 0.5 [2015-11-25]:
    • add JSON and Graphviz/dot lexers,
    • support nonrec keyword in OCaml lexer,
    • use Xtmpl >= 0.13,
    • handle %id as Keyword 5 in OCaml lexer.
  • 0.4 [2014-09-25]:
    • Safe-string mode (require OCaml >= 4.02),
    • OCaml lexer: fix #2: bad lexing of directives on first line,
    • OCaml lexer: handle Lwt keywords as Keyword 10,
  • 0.3 [2014-03-21]:
    • New higlo command line tool,
    • with its mk-higlo script companion.
  • 0.2 [2014-03-20]:
    • ocaml lexer: handle toplevel directives,
    • META: add separate packages higlo.ocaml and higlo.xml, required by higlo.lexers.
  • 0.1 [2014-03-05]: Initial release.
Installation

Higlo requires OCaml > 4.02, Xtmpl >= 0.13.0 and Ulex >= 1.1 to be installed.

To compile and install:

  • tar xvfz higlo-XXX.tar.gz
  • cd higlo-XXX
  • make all install

This will install the higlo, higlo.lexers, higlo.ocaml and higlo.xml packages with findlib. It will also install the higlo command line tool and the mk-higlo script in the same directory as ocamlfind.

License

Higlo is released under the LGPL v3.

Author and contact

Maxence Guesdon <Maxence 'DOT' Guesdon 'AT' inria 'DOT' fr>