TyXML is a library for building statically correct HTML5 and SVG documents:
open Tyxml let to_ocaml = Html.(a ~a:[a_href "ocaml.org"] [pcdata "OCaml!"])
Tyxml can also be used with the standard HTML syntax, using the PPX:
open Tyxml let%html to_ocaml = "<a href='ocaml.org'>OCaml!</a>"
TyXML is available in OPAM:
opam install tyxml
To install the PPX:
opam install tyxml-ppx