########### Serialize ########### .. currentmodule:: turbohtml Turn a tree back into markup or text. Each renderer takes one configuration object: :meth:`Node.serialize` and :meth:`Node.encode` produce HTML under an :class:`Html` config (a :class:`Formatter` picks the escape policy, an :class:`Indent` or :class:`Minify` picks the whitespace, and ``xml=True`` switches to XML/XHTML syntax), and :meth:`Node.serialize_iter` streams the same HTML in bounded ``str`` chunks for a large page (every layout but :class:`Minify`, which needs the whole tree); :meth:`Node.to_markdown` takes a :class:`Markdown` config; and :meth:`Node.to_text` and :meth:`Node.to_annotated_text` take a :class:`PlainText` config; and :meth:`Node.canonicalize` produces Canonical XML (c14n) bytes under a :class:`Canonical` config. :meth:`Node.to_source` takes no config: it losslessly re-emits the verbatim source of everything a mutation left untouched (parse with ``source_locations=True``), the tree-based counterpart to :func:`turbohtml.rewrite.rewrite`. :func:`escape` and :func:`unescape` are the standalone string helpers; :func:`annotation_surface` and :func:`annotation_tags` post-process the annotated-text result. A :class:`~turbohtml.clean.JSMinify` passed to :class:`Minify` extends HTML minification into inline ``