Camlhighlight provides syntax highlighting and pretty-printing facilities for displaying code samples in Ocsigen applications. The library works by interfacing with the library portion of GNU Source-highlight, a popular program supporting the most common programming and markup languages.
Camlhighlight is now at version 3.0, and may be considered stable. You can see an example of the output produced by Camlhighlight. Note that you can configure whether or not to include line numbers and/or zebra stripes in the output. Here's the same code formatted in a more austere fashion.
Camlhighlight requires also GNU Source-highlight, of course. The library has been tested with version 3.1, though subsequent versions should also work. Note that for many Linux distros you may need to manually download and build the source-code for GNU Source-highlight. There are however some distros that already package the library's runtime and development versions. In Debian or Ubuntu, for instance, you only need to apt-get libsource-highlight-dev, which automatically installs all dependencies.
Camlhighlight is distributed in source-code form. You can get all releases from the projects's page at GitHub or the OCaml Forge. The latest version is Camlhighlight 3.0, released on 2014-08-18. Here is the changelog for the last couple of releases:
Camlhighlight uses OASIS. Building and installing follows the costumary configure, make, and make install sequence. To generate the ocamldoc API documentation, run make doc.
You will also need to manually copy the file
into GNU Source-highlight's data directory (normally
Note that if you've installed Camlhighlight via OPAM, this step is not required.)
You can browse the Ocamldoc generated API documentation online.