Skip to main content

html

Jump to function (5)

html/doctype#

(doctype type)

Returns an HTML doctype declaration for the given type. Supports :html4, :xhtml-strict, :xhtml-transitional, and :html5. Defaults to :html5.

Example:

(doctype :html5) ; => (phel.html.raw_string "<!DOCTYPE html>\n")

html/escape-html#

(escape-html s)

Escapes HTML special characters to prevent XSS.

Example:

(escape-html "<div>") ; => "&lt;div&gt;"

html/html#

(html & content)

Compiles nested Phel vectors to HTML strings at compile-time. A vector [tag attrs? children*] becomes an element; tag is a keyword or string, the optional attrs is a map, and children are strings, keywords, raw strings, or nested vectors. Special list forms for, if, when, and when-not are supported for dynamic content.

Example:

(html [:div "Hello"]) ; => "<div>Hello</div>"

html/raw-string#

(raw-string s)

Creates a new raw-string struct.

html/raw-string?#

(raw-string? x)

Checks if x is an instance of the raw-string struct.