package dream-html
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=d0104fbfb19b640dec36008789ed8b0d8f2d1a5945eefbc97a8eb8c134f676c9
sha512=63db1d8578f2fbe5b7049ea73ef5fdc6083ad1f6f45d0e05f5934d24f644496097f7c71a97d4020a2ec48be6b095289bd31709969f1c80987014de4e48851130
doc/dream-html/Dream_html/HTML/index.html
Module Dream_html.HTML
Source
All standard HTML attributes and tags. Some attributes and tags have the same name, e.g. style
. To disambiguate them, attributes have a _
(underscore) suffix.
Attributes
Standard, most non-deprecated attributes from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes. Where an attribute name conflicts with an OCaml keyword, the name is suffixed with _
. Most attributes are constructed by passing in a value of some type.
All string-valued attributes allow formatting (interpolation):
div [id "section-%d" section_id] []
Or plain strings:
p [id "toast"] []
Most boolean attributes are plain values and don't need to be constructed with function calls:
input [required]
However, boolean attributes which may be inherited and toggled on/off in children, are constructed by passing in a value:
div
[contenteditable true]
[p [] [txt "Edit me!"]; p [contenteditable false] [txt "Can't edit me!"]]
Enumerated attributes accept specific values:
input [inputmode `tel]
An attribute that will not be rendered in the markup. Useful for conditional logic where you sometimes want to render an attribute and sometimes not.
p[if should_show then null_ else style_ "display:none"][
txt "Show and tell"]
val autocomplete :
[< `off
| `on
| `name
| `honorific_prefix
| `given_name
| `additional_name
| `honorific_suffix
| `nickname
| `email
| `username
| `new_password
| `current_password
| `one_time_code
| `organization_title
| `organization
| `street_address
| `address_line1
| `address_line2
| `address_line3
| `address_level4
| `address_level3
| `address_level2
| `address_level1
| `country
| `country_name
| `postal_code
| `cc_name
| `cc_given_name
| `cc_additional_name
| `cc_family_name
| `cc_number
| `cc_exp
| `cc_exp_month
| `cc_exp_year
| `cc_csc
| `cc_type
| `transaction_currency
| `transaction_amount
| `language
| `bday
| `bday_day
| `bday_month
| `bday_year
| `sex
| `tel
| `tel_country_code
| `tel_national
| `tel_area_code
| `tel_local
| `tel_extension
| `impp
| `url
| `photo
| `webauthn ]
to_attr
Note that the value of this attribute is not escaped.
Note that the value of this attribute is not escaped.
Note that the value of this attribute is not escaped.
Note: this can't be restricted to just the allowed values for <input type>
, because it's used on other elements e.g. <link type>
.
Tags
HTML tags. Most (standard tags) are constructed by passing a list of attributes and a list of children:
div [id "my-div"] [p [] [txt "Hello"]]
Some (void elements) are constructed only with a list of attributes:
input [required; type_ "email"; name "email-addr"]
Finally, a few (text elements) are constructed with a list of attributes and a single text child:
title [] "Document title"
script [] {|alert('Careful, this is not escaped :-)');|}
A tag that will not be rendered in the markup. Useful for containing a bunch of child nodes inside a single node without having to litter the DOM with an actual node. Also may be called 'splicing'.
null
[ p [] [txt "This paragraph."];
p [] [txt "And this paragraph."];
p []
[txt "Are spliced directly into the document without a containing node."]
]
A <!DOCTYPE html> declaration is automatically prefixed when this tag is printed.