Ideally the library supports a wide range of languages in addition to OCaml, but good support for OCaml is the main requirement.
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.
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}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With