Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What Javascript libraries have good support for syntax highlighting of OCaml code?

Ideally the library supports a wide range of languages in addition to OCaml, but good support for OCaml is the main requirement.

like image 967
Ashish Agarwal Avatar asked Feb 26 '12 23:02

Ashish Agarwal


2 Answers

StackOverflow is using Google Code Prettify. This library supports a lot of canonical languages as mentioned here.

Although OCaml is not the main supported language, you can update lang-ml.js to highlight OCaml syntax better.

like image 146
pad Avatar answered Sep 20 '22 21:09

pad


Using Js-of-ocaml you may use ocaml code for that.

For instance there is one in ocsforge ( http://ocsigen.org/darcsweb/?r=ocsforge;a=tree ):

It uses a patched ocaml lexer ( ocaml/parsing/lexer.mll and the patch src/ocaml_lexer.patch ). The other usefull files for you are src/ocsforge_color.ml and src/ocsforge_color_tokens.ml{,i}

like image 41
Pierre Chambart Avatar answered Sep 16 '22 21:09

Pierre Chambart