HTML beautify / minify
html_formatBeautify or minify HTML with a forgiving tokenizer, preserving script/style/pre/textarea contents and normalizing attribute spacing. Accepts text or file path; optionally removes comments.
Instructions
Beautify (indent block elements, keep inline runs on one line) or minify HTML with a forgiving tokenizer: implied end tags (, , …), void elements, and , , , contents kept byte-for-byte. Whitespace between attributes is normalised; attribute values are never changed. Optional comment removal (IE conditional comments kept). Text only: nothing is rendered or run. Give "text" or a file "path". Web version: https://s3eidat.github.io/html-css-format/
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | "beautify" (default) or "minify". | beautify |
| path | No | Or: a path to a HTML file (UTF-8; use this for big inputs). | |
| text | No | The HTML as inline text. | |
| indent | No | Indentation: 2, 4, "tab" (or any number of spaces 0-8). | 2 |
| output | No | Optional: also write the result to this file path (or folder ending in "/"). The result text is then left out of the reply. Results over 1,000,000 characters are always written to a file. | |
| removeComments | No | Drop comments (IE conditional comments are kept). |