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 Sedlex lexer. Supporting another output format only requires mapping values of type token.
See the OCaml lexer for an example of Higlo Sedlex lexer.
Higlo is hosted on Framagit.
Lang.registered_langs
,(Title n)
token, may be useful for markdown for example,Lang.parse_lexbuf
,Lang.token
type to add length of token text.Higlo requires OCaml >= 4.12.0, Xtmpl &= 1.0.0 and sedlex &= 3.3 to be installed.
To compile and 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.
Higlo is released under the LGPL v3.
Maxence Guesdon <Maxence 'DOT' Guesdon 'AT' inria 'DOT' fr>