Erlang syntax highlighting

Sunday, 12 July 2009

For this site I wanted to use a simple syntax highlighter written in Javascript. Unfortunately, when I searched, none of the existing libraries seemed to support Erlang source code. So I descended like a vulture onto the vim syntax file and somehow mashed it into something that resembles a GNU Source-highlight language definition.


start() ->
    io:fwrite("Hello, world!").

This can then be converted for use with SHJS, which is the library I'm using to highlight the source code above. The .lang file should also work with GNU Source-highlight and any other software using the same format, but I've not tested it.


I've included the converted sh_erlang.js file for use with SHJS, as well as the original erlang.lang file (which depends on number.lang).


This is now used on, which is a cool, easy to search version of the docs, nice one @daleharvey :)