package tyxml-ppx

  1. Overview
  2. Docs
PPX to write TyXML documents with the HTML syntax

Install

Dune Dependency

Authors

Maintainers

Sources

tyxml-4.6.0.tbz
sha256=bfeb673c6b4e120a4eca4c48448add47dc3f8d02c2b40f63ffdccc4e91c902dd
sha512=69750eeaf467014282087bf9628f3278f3e5f00f4c7400358750d208664cfc3f79a5cba16767d2935e53477d1a6862fe08c5b801b69052ec12e09d1a93a5e9b4

Description

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

The TyXML PPX allow to write TyXML documents using the traditional HTML syntax. It works with textual trees, virtual DOM trees, or any TyXML module.

Published: 04 Oct 2023

README

TyXML

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

open Tyxml
let to_ocaml = Html.(a ~a:[a_href "ocaml.org"] [txt "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>"

Finally, TyXML can be used with Reason's JSX syntax:

open Tyxml;
let to_reason = <a href="reasonml.github.io/"> "Reason!" </a>

TyXML provides a set of combinators which use the OCaml type system to ensure the validity of the generated document. TyXML can be used on a wide variety of context, either to produce textual documents, to manipulate the DOM tree using Js_of_ocaml, build virtual DOM with virtual-dom, or for tierless web programming with Eliom.

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

Installation

TyXML is available in OPAM:

opam install tyxml

To install the PPX:

opam install tyxml-ppx

To install the JSX:

opam install tyxml-jsx

Dependencies (6)

  1. ppxlib >= "0.18"
  2. markup >= "0.7.2"
  3. tyxml-syntax = version
  4. tyxml = version
  5. ocaml >= "4.04"
  6. dune >= "2.7"

Dev Dependencies (2)

  1. odoc with-doc
  2. alcotest with-test

Used by (2)

  1. dream >= "1.0.0~alpha2" & < "1.0.0~alpha5"
  2. sihl-queue >= "0.4.0"

Conflicts

None