Are you happy with your logging solution? Would you help us out by taking a 30-second survey? Click here


Build valid HTML and SVG documents

Subscribe to updates I use tyxml

Statistics on tyxml

Number of watchers on Github 53
Number of open issues 29
Average time to close an issue about 2 months
Main language OCaml
Average time to merge a PR 20 days
Open pull requests 16+
Closed pull requests 7+
Last commit about 2 years ago
Repo Created over 6 years ago
Repo Last Updated almost 2 years ago
Size 27 MB
Homepage https://ocsigen.o...
Organization / Authorocsigen
Latest Release4.2.0
Page Updated
Do you use tyxml? Leave a review!
View open issues (29)
View tyxml activity
View on github
Fresh, new opensource launches 🚀🚀🚀
Trendy new open source projects in your inbox! View examples

Subscribe to our mailing list

Evaluating tyxml for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)


TyXML is a library for building statically correct HTML5 and SVG documents:

open Tyxml
let to_ocaml = Html.(a ~a:[a_href ""] [pcdata "OCaml!"])

Tyxml can also be used with the standard HTML syntax, using the PPX:

open Tyxml
let%html to_ocaml = "<a href=''>OCaml!</a>"

TyXML provides a set of combinators. These combinators use the OCaml type system to ensure the validity of the generated document. They are used in various libraries, such as Eliom and Js_of_ocaml.

The documentation can be consulted on the TyXML website. Examples are available in the examples directory.


TyXML is available in OPAM:

opam install tyxml

To install the PPX:

opam install tyxml-ppx
tyxml open issues Ask a question     (View All Issues)
  • over 3 years Missing `a_role`
  • over 3 years Naming consistency
  • almost 4 years Tyxml should not accept a form as an indirect descendant of another form
  • almost 4 years Provide a translation module between html and js attributes
  • almost 4 years Ppx ideas
  • almost 4 years IDEs and the ppx
  • almost 4 years Allow (optional) sloppy parsing in the ppx
  • almost 4 years Covariance issues with wrapping
  • almost 4 years Composability issues with the ppx
  • almost 4 years Generate coverage reports to help with writing tests
  • almost 4 years Figure out a way to export to lambdasoup
  • almost 5 years Consistent naming scheme for html and svg elements.
  • about 5 years Merge classes when several class attributes given
  • about 5 years Templating and ppx for tyxml
  • about 6 years support for dtd parsing (depend/merge with xmllight?)
tyxml open pull requests (View All Pulls)
  • Replace some option-like variants by options.
  • Remove cellspacing, cellpadding, charoff.
  • Do not escape comments
  • Various improvements to the ppx:
  • Restore compatibility with 4.03
  • README fixes
  • Mark some HTML attributes deprecated
  • Support date-time format in <input> min, max
  • New README
  • Remove form methods PUT and DELETE
  • Type safe templating (with mustache)
  • Support for Uutf 1.0.0.
  • Added a_clip_path attribute.
  • Allow restricted flow content in dt elements
  • Simplistic indentation for the Format-based printer.
  • jbuilder WIP
tyxml list of languages used
tyxml latest release notes
4.2.0 Version 4.2.0
  • Compatibility with OCaml 4.6.0.
  • The ppx should now be compatible with driver-based workflows. In particular, jbuilder.
  • Future breakage:
    • The two camlp4-based packages (tyxml.syntax and tyxml.parser) are now deprecated and will be removed in the next major version.
    • Introduction of the tyxml-ppx ocamlfind package. Usage of the tyxml.ppx package is discouraged, and it will be removed in the next major version.
  • Various fixes in the Html_sigs.T module (contribution by Fabian Pijcke):
    • Fixed the map element function signature.
    • The elements functions now (almost) all make use of the types defined in Html_types, rather than redefining them.
    • Html_sigs.T.fieldset now takes [< legend] elt wrap as optional argument rather than legend elt wrap.
  • Add basic support for aria-* attributes (contribution by Armal Guneau) (see
  • Add support for the role attribute (contribution by Armal Guneau) (see
  • Add support for the minlength form attribute (contribution by Armal Guneau) (See
4.1.0 Version 4.1.0
  • Uses uutf 1.0 (contribution by Daniel Bunzli)
4.0.1 4.0.1

Version 4.0.1

  • Fix handling of comments in the ppx.
  • Fix printing of utf8 in attributes.
  • Properly flush ppx errors. This bug was causing some blank error messages.
  • Fix handling of whitespaces in <select> in the ppx.
Other projects in OCaml