package html_of_jsx

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
module Attribute : sig ... end
type node = {
  1. tag : string;
  2. attributes : Attribute.t list;
  3. children : element list;
}
and element =
  1. | Null
  2. | Text of string
  3. | Unsafe of string
  4. | Fragment of element list
  5. | Node of node
  6. | Component of unit -> element
  7. | List of element list

The type that represents a Jsx.element, it's a recursive type that allows to represent any HTML structure

val text : string -> element

Helper to represent an element as a string

val unsafe : string -> element

Helper to bypass HTML encoding and treat output as unsafe. This can lead to HTML scaping problems, XSS inject scripting and other security concerns, use with caution.

val null : element

Helper to represent nullability in Jsx, useful to pattern match

val int : int -> element

Helper to render an integer (uses string_of_int)

val float : float -> element

Helper to render an integer (uses string_of_float)

val list : element list -> element
val fragment : element list -> element

Fragment

val node : string -> Attribute.t list -> element list -> element

The function to create a HTML DOM Node https://developer.mozilla.org/en-US/docs/Web/API/Node. Given the tag, list of attributes and list of childrens

OCaml

Innovation. Community. Security.