HTML text as tokens, by the tokenizer of the HTML Standard, section 13.2.5, as of 2026-10-08, but without parse errors.
The tokenizer is for HTML embedded in other content, so it leaves out what only whole documents and SVG or MathML need. Each part ends where the standard ends it, so no other token changes:
<? starts a bogus comment, as before the processing instructions of 13.2.5.72 to 13.2.5.76
TODO: read these too, by an option or a namespace of their own, for a parser of whole documents or of SVG and MathML.
HTML text as tokens, by the tokenizer of the HTML Standard, section 13.2.5, as of 2026-10-08, but without parse errors. The tokenizer is for HTML embedded in other content, so it leaves out what only whole documents and SVG or MathML need. Each part ends where the standard ends it, so no other token changes: - a DOCTYPE runs to the next >, without its name, identifiers or the force-quirks flag, 13.2.5.53 to 13.2.5.68 - <? starts a bogus comment, as before the processing instructions of 13.2.5.72 to 13.2.5.76 - a CDATA section is a bogus comment, as it is outside SVG and MathML, without the CDATA states of 13.2.5.69 to 13.2.5.71 TODO: read these too, by an option or a namespace of their own, for a parser of whole documents or of SVG and MathML.
The state that the tokenizer switches to after the start tag of each of these elements, as the tree builder does for HTML content with scripting off, in section 13.2.6.4.7.
The state that the tokenizer switches to after the start tag of each of these elements, as the tree builder does for HTML content with scripting off, in section 13.2.6.4.7.
(tokens s)(tokens s
{:keys [state last-start-tag text-states]
:or {state :data text-states text-states}})The tokens of the HTML text s, as a vector, read with the opts below.
Text comes as strings, with adjacent runs joined and character references decoded. Every other token is a map, e.g.
{:type :start-tag :name "a" :attrs {"href" "/"}
:self-closing? false}
{:type :end-tag :name "a"}
{:type :comment :data " a note "}
{:type :doctype}
The options are:
The tokens of the HTML text `s`, as a vector, read with the `opts` below.
Text comes as strings, with adjacent runs joined and character references
decoded. Every other token is a map, e.g.
{:type :start-tag :name "a" :attrs {"href" "/"}
:self-closing? false}
{:type :end-tag :name "a"}
{:type :comment :data " a note "}
{:type :doctype}
The options are:
- :state, the state to start in: :data, the default, :rcdata, :rawtext,
:script-data or :plaintext
- :last-start-tag, the name of the last start tag, which an end tag in
raw text must match, as when the text follows that tag
- :text-states, the state to switch to after the start tag of each
element, text-states by defaultcljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |