# The HTML dialect The HTML `adfToHtml` writes: semantic elements for the nodes and marks below, and the carry element for every other node (`docs/decisions.md` §The HTML dialect). The written form is contract (`docs/decisions.md` §The formats are API). ## Blocks One block a line: blocks are separated by a line feed, and a document holding any ends with one. A document whose `content` is an empty array is the empty string. | ADF | HTML | | --- | --- | | `paragraph` | `
…
` | | `heading`, `level` 1 to 6 | ``, a line feed, its blocks, a line feed, `` | | `bulletList` | `
…`, the language one token holding no whitespace; no `class` where it holds no `language` |
| `rule` | ``. A code block's
`data-*` attributes stand on its ``.
## Inline
| ADF | HTML |
| --- | --- |
| `text` | its text, escaped |
| `em`, `strong`, `code` | ``, ``, `` around the text |
| `link`, holding `href` and an optional `title` | `` around the text |
| `hardBreak` | `
` |
A text node's marks nest in the order its `marks` array lists them, the first outermost:
`manual`. Each text node writes its own elements, so two text nodes a link
marks are two `` elements.
## Escaping
Text and attribute values escape `&`, `<`, `>` and `"` as `&`, `<`, `>` and `"`.
Attribute values are double-quoted. A link's `href` and an image's `src` are the URL as the ADF
holds it, whatever its scheme (`docs/decisions.md` §HTML writes a URL as the ADF holds it, whatever
its scheme).
HTML text and attribute values cannot hold a carriage return, which a parser reads as a line feed,
a control other than a tab, line feed or form feed, a noncharacter, or a lone surrogate, which
UTF-8 cannot encode (WHATWG HTML §13.1.3). A node holding one in a value its element writes rides
the carry.
## The carry element
A node the sections above cannot write where it stands is the carry element: `` in block
position, `` inline, of class `adf-carry`, holding the node's JSON in `data-adf` and showing
its content. A carry element may hold a node the sections above write, as the markdown carry may:
it reads back as the node it holds, so HTML stored while a node rode the carry reads the same once a
later release writes it as its own element.
```html
Read the CommonMark spec first.
Then import.
Ask @Mikael
```
- `data-adf` holds the node's JSON compact, keys sorted, as `!adf:carry` does in markdown, its type
included, each character HTML cannot hold spelled as a JSON escape, `\u0085`. A document holding
no `content` key is the block carry of `{"type":"doc","version":1}`.
- The content shown is every text node's text below the node, and what a node holding no text shows
in its place: a mention's text, else `@` and its id; an emoji's text, else its `shortName`; a
status's text; a date as `2026-09-13` in UTC; a card's URL, else its name, else the URL its data
holds; media's `alt`, else an external one's URL; an extension's text; an expand's title.
- In a `