Module Htmlg.El

Elements.

Elements

type name = string

The type for element names.

type child

The type for element children. Either textual data or an element or a sequence thereof.

val v : name -> ?⁠a:Att.t list -> child list -> child

v n ~a cs is an element with name n, attributes a (defaults to []) and children cs. It is illegal to specify an attribute name more than once in a except for Att.class' which is treated specially: multiple specifications are gathered to form a single space seperated attribute value for the class attribute.

val txt : string -> child

txt d is character data d.

val splice : child list -> child

splice cs when added to a child list splices cs into the list.

val raw : string -> child

raw s is the raw string s without escaping markup delimiters. This can be used to include foreign markup.

Output

val buffer_add : doc_type:bool -> Stdlib.Buffer.t -> child -> unit

buffer_add ~doc_type b c adds child c (or children if c is a splice) to b. If doc_type is true an HTML doctype declaration is prepended.

val to_string : doc_type:bool -> child -> string

to_string is like buffer_add but returns directly a string.

Predefined element constructors

Convention. Whenever an element name conflicts with an OCaml keyword we prime it, see for example object'.

type cons = ?⁠a:Att.t list -> child list -> child

The type for element constructors. This is simply v with a pre-applied element name.

type void_cons = a:Att.t list -> child

The type for void element constructors. This is simply el with a pre-applied element name and without children.

val a : cons

a

val abbr : cons

abbr

val address : cons

address

val area : void_cons

area

val article : cons

article

val aside : cons

aside

val audio : cons

audio

val b : cons

b

val base : void_cons

base

val bdi : cons

bdi

val bdo : cons

bdo

val blockquote : cons

blockquote

val body : cons

body

val br : void_cons

br

val button : cons

button

val canvas : cons

canvas

val caption : cons

caption

val cite : cons

cite

val code : cons

code

val col : void_cons

col

val colgroup : cons

colgroup

val command : cons

command

val datalist : cons

datalist

val dd : cons

dd

val del : cons

del

val details : cons

details

val dfn : cons

dfn

val div : cons

div

val dl : cons

dl

val dt : cons

dt

val em : cons

em

val embed : void_cons

embed

val fieldset : cons

fieldset

val figcaption : cons

figcaption

val figure : cons

figure

footer

val form : cons

form

val h1 : cons

h1

val h2 : cons

h2

val h3 : cons

h3

val h4 : cons

h4

val h5 : cons

h5

val h6 : cons

h6

val head : cons

head

val header : cons

header

val hgroup : cons

hgroup

val hr : void_cons

hr

val html : cons

html

val i : cons

i

val iframe : cons

iframe

val img : void_cons

img

val input : void_cons

input

val ins : cons

ins

val kbd : cons

kbd

val keygen : cons

keygen

val label : cons

label

val legend : cons

legend

val li : cons

li

link

val map : cons

map

val mark : cons

mark

val menu : cons

menu

val meta : void_cons

meta

val meter : cons

meter

val nav : cons

nav

val noscript : cons

noscript

val object' : cons

object

val ol : cons

ol

val optgroup : cons

optgroup

val option : cons

option

val output : cons

output

val p : cons

p

val param : void_cons

param

val pre : cons

pre

val progress : cons

progress

val q : cons

q

val rp : cons

rp

val rt : cons

rt

val ruby : cons

ruby

val s : cons

s

val samp : cons

samp

val script : cons

script

val section : cons

section

val select : cons

select

val small : cons

small

val source : void_cons

source

val span : cons

span

val strong : cons

strong

val style : cons

style

val sub : cons

sub

val summary : cons

summary

val sup : cons

sup

val table : cons

table

val tbody : cons

tbody

val td : cons

td

val textarea : cons

textarea

val tfoot : cons

tfoot

val th : cons

th

val thead : cons

thead

val time : cons

time

val title : cons

title

val tr : cons

tr

val track : void_cons

track

val u : cons

u

val ul : cons

ul

val var : cons

var

val video : cons

video

val wbr : void_cons

wbr