webdev_code_formatter
Format or minify HTML, CSS, or JavaScript code with configurable indentation and comment preservation. Select language and action, returns processed code with size and line statistics.
Instructions
HTML/CSS/JS Code Formatter and Minifier. Pretty-print or minify a single HTML, CSS, or JavaScript snippet using whitespace/brace indentation rules. Set language to pick the dialect and action to format (readable, indented) or minify (whitespace/comments stripped). This is the multi-language dispatcher: use webdev_css_beautifier or webdev_javascript_beautifier for those single languages, and webdev_sql_formatter, json_formatter, or webdev_xml_formatter for SQL/JSON/XML (not supported here). Heuristic whitespace formatter, not an AST validator, so JSX, template literals, and malformed input may need review. Runs locally via a Node bridge: read-only, non-destructive, contacts no external service, rate-limited (60 req/min anon). Returns the processed output plus size/line statistics.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Source code to process (alias: input). Must be non-empty. | |
| language | No | Source dialect. Unknown values fall back to html. | html |
| action | No | format = readable indentation; minify = strip whitespace (and comments unless preserved). Any value other than "minify" is treated as format. | format |
| options | No | Formatting/minifying options. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| input | No | The original code, echoed back. | |
| output | No | The formatted or minified result. | |
| language | No | Language actually used (post-fallback). | |
| action | No | Action actually applied. | |
| statistics | No | Size and line metrics comparing input to output. |