Minified HTML — Compact Cleaned Markup
Choose Minified HTML when you want extracted content as HTML with compact source formatting. It retains the selected headings, paragraphs, lists, links, tables, and images. The source is cleaned content, so this output does not reproduce the page that supplied it.
Select content once, render it twice
Markdownee renders readable HTML and Minified HTML from the same cleaned content. The selected layout and parsed content agree; whitespace and other presentation bytes differ. Request either format or both.
Readable markup is convenient for inspecting source:
<article>
<h1>Example</h1>
<p>A short extracted paragraph.</p>
</article>
A compact presentation carries the same structure:
<article><h1>Example</h1><p>A short extracted paragraph.</p></article>
Use outputLayout on the TypeScript npm and Actor surfaces, or output_layout in the native Python API, to choose the surrounding document:
minimalproduces an HTML fragment.standardproduces a complete document with ordinary metadata in a generated head.enhancedincludes additional allowlisted metadata and crawl information.
The layout decision is independent of whitespace formatting. A complete document can be compact, and a fragment can use readable formatting.
Request and save the format
The selector uses a hyphen; result field names follow each language's convention:
| Interface | Identifier |
|---|---|
| Format selector | minified-html |
| JavaScript, TypeScript, API, and dataset result | minifiedHtml |
Python fetch and afetch result | minified_html |
| Multi-format file suffix | .min.html |
CLI fetch accepts minified-html-file and minified-html-stdout. Crawl and Actor storage routes use minified-html-dataset and minified-html-kvs. The npm library provides the equivalent SaveFormat.MinifiedHtml, Save.MinifiedHtmlDataset, and Save.MinifiedHtmlKvs aliases.
When several HTML representations are written together, their suffixes distinguish them: .html for readable output, .min.html for compact output, and .original.html for the crawler capture. An explicitly named single output keeps the chosen filename. Consult the CLI and Actor guides for each destination.
Treat whitespace as part of HTML
Use an HTML-aware parser and formatter when expanding compact markup. A regular expression that inserts a newline after each > cannot distinguish a tag boundary from an attribute or text value. Character references, void elements, and malformed markup also have parser-defined behavior.1
Whitespace can change content, especially in <pre> and <textarea> and between inline elements. Parse, format with suitable whitespace rules, and serialize; inspect the resulting text when fidelity matters.
Parsing is separate from sanitization. Scripts and event handlers are disabled in the document returned by DOMParser.parseFromString(), but embedded resources can still be requested. Moving parsed nodes into an active document can enable handlers or other behavior. Sanitize at the receiving boundary and use Trusted Types where available before passing untrusted markup to an injection sink.2
Markdownee's cleaning does not replace the receiving application's rendering policy. Reading attributes from a tree and inserting the same markup with innerHTML are different operations.
Keep the crawler capture separately
| Output | Source and purpose |
|---|---|
| Readable HTML | Cleaned content formatted for inspection |
| Minified HTML | The same cleaned content formatted compactly |
| Original HTML | Crawler-captured HTML before content extraction |
The original can contain page furniture, scripts, styles, and consent markup. It may already reflect browser rendering, parser serialization, and consent handling, so it is not a byte-exact server response. On the TypeScript discovery path, a Markdown-sourced page derives this field from the served representation and records markdownSource.
Save original for investigation or reprocessing when that capture is useful. Minifying extracted content cannot restore material removed during extraction. The format guide compares these HTML choices with Markdown and plain text.
Citations
-
WHATWG: HTML Standard — Parsing HTML documents. Retrieved July 26, 2026 ↩
-
WHATWG: DOMParser interface and MDN Web Docs: DOMParser: parseFromString() method. Retrieved September 29, 2026 ↩
Updated: September 29, 2026