<h1>HTML Output</h1>

<h2>Synopsis</h2>

<code>(import (data html))</code>

Encoding of S-expressions as

<h2>S-Expression HTML Grammar</h2>

Elements are represented as lists starting with a tag symbol, optionally followed by an association list of attributes and by element contents:
<code><pre>
html    → (SYMBOL content ...)
        | (SYMBOL ((SYMBOL . value) ...) content ...)


The value of an attribute may be a boolean or a list of text contents:
<code><pre>
value   → BOOLEAN
        | (text ...)


An attribute with value <tt>#f</tt> is not serialized as HTML5; an attribute with value <tt>#t</tt> is serialized without a value assignment in HTML5.

The contents of elements and attributes may consist of plain text and entity references represented as symbols or positive integers. Normal elements may also contain other elements:
<code><pre>
content → text
        | html

text    → STRING
        | NUMBER
        | SYMBOL


<h2>Operations</h2>

<h3>procedure: <code>(html-tag-rule
<h3>procedure: <code>(html-tag-rule <i>tag</i>

Get or set serialization rules for the given tag. The rule may be <tt>void</tt>, <tt>raw</tt> or <tt>normal</tt>. <tt>void</tt> elements cannot have contents, <tt>raw</tt> elements cannot have other elements as contents and <tt>normal</tt> elements are the default.

<h3>procedure: <code>(write-html
<h3>procedure: <code>(write-html <i>html</i>

Write an S-expression as HTML5 to the given port or to the <tt>(current-output-port)</tt>.