# html/serialize
Serialize a parsed document back to HTML. Round-trips what the parser
normalised — entity decoding is re-encoded, repaired markup comes out
well-formed.
## Syntax
[html/serialize $src|$doc ?opts]
## Parameters
- `$src` — HTML source text (string) or a `%HtmlDocument` handle from
`html/open`
- `$opts` — optional map: `:inner true` for the innerHTML of `<body>`
## Examples
[html/serialize "<!DOCTYPE html><p>a & b</p>"] # => "<!DOCTYPE html><html><head></head><body><p>a & b</p></body></html>" [html/serialize "<p>a & b</p>" %{ :inner true }] # => "<p>a & b</p>"
## Returns
A string. Whole-document output serializes the doctype plus the `<html>`
tree (a fragment input gains the html/head/body skeleton — the parser
always builds one). `:inner true` concatenates the children of `<body>`
(the skeleton is not emitted).
Top-level whitespace-only text nodes are dropped; everything else is
preserved. Failures return `%Err{ :message "..." }`.
## See Also
`html/parse`, `html/open`, `xml/stringify`