Skip to main content

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 to choose the surrounding document:

  • minimal produces an HTML fragment.
  • standard produces a complete document with ordinary metadata in a generated head.
  • enhanced includes 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; structured result fields use camel case:

InterfaceIdentifier
Format selectorminified-html
JavaScript, TypeScript, API, and dataset resultminifiedHtml
Multi-format file suffix.min.html

CLI crawl-one 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. A document created by DOMParser is effectively inert, but inserting its nodes into a visible document can activate handlers or other content. 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

OutputSource and purpose
Readable HTMLCleaned content formatted for inspection
Minified HTMLThe same cleaned content formatted compactly
Original HTMLCrawler-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. For a Markdown-sourced page, Markdownee 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

  1. WHATWG: HTML Standard — Parsing HTML documents. Retrieved July 26, 2026

  2. MDN Web Docs: DOMParser: parseFromString() method. Retrieved July 26, 2026

Updated: September 7, 2026