--indent-size), while the library API and config files use underscores (e.g., indent_size). The two forms are interchangeable — the option parser normalizes dashes to underscores internally.
Common options
These options apply to all three beautifiers (JavaScript, CSS, and HTML).Number of spaces per indentation level. Overridden by
indent_with_tabs.Character used for indentation. Defaults to a single space. Set to
"\t" or use indent_with_tabs instead.Indent with tab characters instead of spaces. When
true, overrides indent_size and sets indent_char to "\t". If indent_size is 1 when this is enabled, it resets to 4.Line terminator sequence. Defaults to
"auto", which uses the first newline found in the file, or "\n" if none is found. Accepts "\n", "\r\n", or "\r".Append a newline at the end of the output.
Read indentation and line-ending settings from the nearest
.editorconfig file. Explicit options passed alongside this flag take precedence. See EditorConfig Integration.Preserve indentation whitespace on otherwise empty lines. By default, empty lines are left with no leading whitespace.
JavaScript options
These options are recognized only by the JavaScript beautifier.Defaults
eval_code and space_before_conditional are not exposed as CLI flags. They can only be set via the library API or a config file.Option reference
Initial indentation level applied before beautification begins. Useful when embedding beautified output inside another structure.
Keep existing blank lines in the source. Pass
--no-preserve-newlines on the CLI to disable.Maximum number of consecutive blank lines to preserve in one place. Has no effect when
preserve_newlines is false.Add padding spaces inside parentheses:
f( a, b ) instead of f(a, b).Add a single space inside empty parentheses:
f( ) instead of f().Enable jslint-compatible output. When
true, forces space_after_anon_function to true as well.Add a space between the
function keyword and the opening parenthesis of anonymous functions: function () instead of function().Add a space between the
function keyword and the opening parenthesis of named functions: function example () instead of function example().Controls placement of curly braces. Accepted values:
collapse— Opening brace on same line as control statement (K&R style).expand— Opening brace on its own line (Allman style).end-expand— Opening brace on same line, closing brace on its own line.none— Leave brace placement as-is.
,preserve-inline to any value to keep single-line blocks on one line: "collapse,preserve-inline".Do not add extra indentation for chained method calls.
Place each chained method call on its own line.
Preserve the original indentation of array elements.
Decode printable ASCII characters encoded in
\xNN notation back to their literal form.Wrap lines that exceed this number of characters.
0 disables wrapping.Pass E4X XML literals through the beautifier unchanged.
Place commas at the beginning of each new line rather than at the end.
Where to place binary operators when a line breaks. Accepted values:
before-newline— Operator stays at the end of the upper line.after-newline— Operator moves to the beginning of the lower line.preserve-newline— Keep the operator wherever it appears in the source.
List of templating languages whose syntax should be preserved. Accepted values:
auto, none, angular, django, erb, handlebars, php, smarty. auto means no templating in JavaScript mode.Attempt to beautify code passed to
eval(). Not exposed as a CLI flag.Add a space before conditional statements (
if, for, etc.). Not exposed as a CLI flag.CSS options
Controls placement of curly braces. Only
collapse and expand are implemented for CSS.collapse— Opening brace on same line as selector.expand— Opening brace on its own line.
Place each selector in a comma-separated list on its own line.
Add a blank line between CSS rule blocks.
Add spaces around combinator characters (
>, +, ~). Also settable via the legacy space_around_selector_separator.HTML options
Indent the contents of
<head> and <body> tags.Indent the contents of the
<body> tag.Indent the contents of the
<head> tag.How to handle indentation of content inside
<script> tags. Accepted values: normal, keep, separate.Maximum characters per line for HTML output.
0 disables wrapping.How to wrap HTML tag attributes when a tag is long. Accepted values:
auto— Only wrap when the line exceedswrap_line_length.force— Wrap each attribute onto its own line.force-aligned— Wrap and align attributes to the first attribute.force-expand-multiline— Wrap each attribute, including the first.aligned-multiple— Align multiple attributes per line.preserve— Preserve existing line breaks in attributes.preserve-aligned— Preserve and align to the first attribute.
Minimum number of attributes required before forced wrapping applies (used with
force wrap modes).Number of characters to indent wrapped attributes. Defaults to
indent_size. Ignored when wrap_attributes is "aligned".List of tag names treated as inline elements. These are not forced onto new lines. Defaults to the full set of HTML inline elements (
a, abbr, b, br, code, em, img, input, span, etc.).Treat custom elements (e.g.
<my-component>) as inline elements.List of tag names whose opening tags, content, and closing tags are left completely unchanged.
List of tag names whose inner content is preserved as-is, but whose tags themselves are still formatted.
Keep all text content between occurrences of this string on one line.
List of tags that should be preceded by an extra blank line.
Templating languages to preserve. In HTML mode,
auto enables django, erb, handlebars, and php by default.