package cow

  1. Overview
  2. Docs

(X)HTML library

type t = Cow_xml.t

A sequence of (X)HTML trees.

val doctype : string
val to_string : t -> string

to_string html is a valid (X)HTML5 polyglot string corresponding to the html structure.

val of_string : ?enc:Cow_xml.encoding -> string -> t

of_string ?enc html_str is the tree representation of html_str as decoded by enc. For more information about the default encoding, see inenc.

Note that this function converts all standard entities into their corresponding UTF-8 symbol.

val output : ?nl:bool -> ?indent:int option -> ?ns_prefix:(string -> string option) -> Xmlm.dest -> t -> unit

Outputs valid (X)HTML5 polyglot text from a t. Only non-void element handling is implemented so far. For more information about the parameters, see Xmlm.make_output.

val output_doc : ?nl:bool -> ?indent:int option -> ?ns_prefix:(string -> string option) -> Xmlm.dest -> t -> unit

Outputs a valid (X)HTML5 polyglot document from a t. Only non-void element handling and HTML5 DOCTYPE is implemented so far. For more information about the parameters, see Xmlm.make_output.

HTML library

type rel = [
  1. | `alternate
  2. | `author
  3. | `bookmark
  4. | `help
  5. | `license
  6. | `next
  7. | `nofollow
  8. | `noreferrer
  9. | `prefetch
  10. | `prev
  11. | `search
  12. | `tag
]
type target = [
  1. | `blank
  2. | `parent
  3. | `self
  4. | `top
  5. | `Frame of string
]
val a : ?hreflang:string -> ?rel:rel -> ?target:target -> ?ty:string -> ?title:string -> ?cls:string -> href:Uri.t -> t -> t

a href html generate a link from html to href.

  • parameter title

    specifies extra information about the element that is usually as a tooltip text when the mouse moves over the element. Default: None.

  • parameter target

    Specifies where to open the linked document.

  • parameter rel

    Specifies the relationship between the current document and the linked document. Default: None.

  • parameter hreflang

    the language of the linked document. Default: None.

  • parameter ty

    Specifies the media type of the linked document.

val img : ?alt:string -> ?width:int -> ?height:int -> ?ismap:Uri.t -> ?title:string -> ?cls:string -> Uri.t -> t
val interleave : string array -> t list -> t list
val html_of_string : string -> t
val string : string -> t
val html_of_int : int -> t
  • deprecated

    use int

val int : int -> t
val html_of_float : float -> t
val float : float -> t
type table = t array array
val html_of_table : ?headings:bool -> table -> t
val nil : t
val empty : t
val concat : t list -> t
val list : t list -> t
val some : t option -> t
val append : t -> t -> t

append par ch appends ch to par

val (++) : t -> t -> t
module Create : sig ... end

HTML nodes

type node = ?cls:string -> ?id:string -> ?attrs:(string * string) list -> t -> t

The type for nodes.

val div : node

div ~cls t is <div class="cls">t</div>.

val span : node

div ~cls: t is <div class="cls">t</div>.

val input : node
val meta : ?cls:string -> ?id:string -> ?attrs:(string * string) list -> ?name:string -> ?content:string -> ?charset:string -> t -> t
val br : node
val hr : node
val source : node
val wbr : node
val param : node
val embed : node
val col : node
val track : node
val keygen : node
val anchor : string -> t
val base : ?cls:string -> ?id:string -> ?attrs:(string * string) list -> ?href:Uri.t -> ?target:string -> t -> t
val style : ?cls:string -> ?id:string -> ?attrs:(string * string) list -> ?media:string -> ?typ:string -> t -> t
val h1 : node
val h2 : node
val h3 : node
val h4 : node
val h5 : node
val h6 : node
val small : node
val li : node
val dt : node
val dd : node
val ul : ?add_li:bool -> ?cls:string -> ?id:string -> ?attrs:(string * string) list -> ?licls:string -> t list -> t
val ol : ?add_li:bool -> ?cls:string -> ?id:string -> ?attrs:(string * string) list -> ?licls:string -> t list -> t
val dl : ?add_dtdd:bool -> ?cls:string -> ?id:string -> ?attrs:(string * string) list -> ?dtcls:string -> ?ddcls:string -> (t * t) list -> t
val tag : string -> node
val i : node
val p : node
val tt : node
val blockquote : ?cls:string -> ?id:string -> ?attrs:(string * string) list -> ?cite:Uri.t -> t -> t
val pre : node
val figure : ?cls:string -> ?id:string -> ?attrs:(string * string) list -> ?figcaption:t -> t -> t
val main : node
val em : node
val strong : node
val s : node
val cite : node
val q : ?cls:string -> ?id:string -> ?attrs:(string * string) list -> ?cite:Uri.t -> t -> t
val dfn : ?cls:string -> ?id:string -> ?attrs:(string * string) list -> ?title:string -> t -> t
val abbr : ?cls:string -> ?id:string -> ?attrs:(string * string) list -> ?title:string -> t -> t
val data : ?cls:string -> ?id:string -> ?attrs:(string * string) list -> value:string -> t -> t
val time : ?cls:string -> ?id:string -> ?attrs:(string * string) list -> ?datetime:string -> t -> t
val code : node
val var : node
val samp : node
val kbd : node
val sub : node
val sup : node
val b : node
val u : node
val mark : node
val bdi : node
val bdo : node
val ruby : node
val rb : node
val rt : node
val rtc : node
val rp : node
val aside : node
val ins : ?cls:string -> ?id:string -> ?attrs:(string * string) list -> ?cite:Uri.t -> ?datetime:string -> t -> t
val del : ?cls:string -> ?id:string -> ?attrs:(string * string) list -> ?cite:Uri.t -> ?datetime:string -> t -> t
val html : node
val title : node
val head : node
val header : node
val body : node
val nav : node
val section : node
val article : node
val address : node
val script : ?src:string -> ?typ:string -> ?charset:string -> t -> t
OCaml

Innovation. Community. Security.