diff --git a/CHANGELOG.md b/CHANGELOG.md index 820d64cb2..8f4c48c0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ + +# v0.33.2 (2018-09-12) +- (BREAKING CHANGE) Added `inline` and `content_unformatted` options from `js-beautify` html settings and cleared `unformatted`. Breaking change but generally improves the behavior to more accurately beautify html. ([#2210](https://github.com/Glavin001/atom-beautify/issues/2210), [#2215](https://github.com/Glavin001/atom-beautify/pull/2215), [js-beautify#1407](https://github.com/beautify-web/js-beautify/pull/1407)) + # v0.33.1 (2018-09-09) - Remove dependency marko-prettyprint in an effort to resolve installation and update issues diff --git a/docs/options.md b/docs/options.md index 99cb129a8..a3a7339aa 100644 --- a/docs/options.md +++ b/docs/options.md @@ -796,12 +796,14 @@ Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by b | `default_beautifier` | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | | `brace_style` | :white_check_mark: | +| `content_unformatted` | :white_check_mark: | | `end_with_newline` | :white_check_mark: | | `extra_liners` | :white_check_mark: | | `indent_char` | :white_check_mark: | | `indent_inner_html` | :white_check_mark: | | `indent_scripts` | :white_check_mark: | | `indent_size` | :white_check_mark: | +| `inline` | :white_check_mark: | | `max_preserve_newlines` | :white_check_mark: | | `preserve_newlines` | :white_check_mark: | | `unformatted` | :white_check_mark: | @@ -896,6 +898,35 @@ Automatically beautify Blade files on save } ``` +##### [Content unformatted](#content-unformatted) + +**Namespace**: `html` + +**Key**: `content_unformatted` + +**Default**: `pre,textarea` + +**Type**: `array` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +List of tags whose contents should not be reformatted. Attributes will be reformatted, inner html will not. (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "content_unformatted": [ + "pre", + "textarea" + ] + } +} +``` + ##### [End with newline](#end-with-newline) **Namespace**: `html` @@ -1054,65 +1085,13 @@ Indentation size/length (Supported by JS Beautify) } ``` -##### [Max preserve newlines](#max-preserve-newlines) - -**Namespace**: `html` - -**Key**: `max_preserve_newlines` - -**Default**: `10` - -**Type**: `integer` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Number of line-breaks to be preserved in one chunk (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "max_preserve_newlines": 10 - } -} -``` - -##### [Preserve newlines](#preserve-newlines) - -**Namespace**: `html` - -**Key**: `preserve_newlines` - -**Default**: `true` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Preserve line-breaks (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "preserve_newlines": true - } -} -``` - -##### [Unformatted](#unformatted) +##### [Inline](#inline) **Namespace**: `html` -**Key**: `unformatted` +**Key**: `inline` -**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,ins,small,strike,tt,pre,h1,h2,h3,h4,h5,h6` +**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,ins,strike,tt` **Type**: `array` @@ -1120,14 +1099,14 @@ Preserve line-breaks (Supported by JS Beautify) **Description**: -List of tags (defaults to inline) that should not be reformatted (Supported by JS Beautify) +List of inline tags. Behaves similar to text content, will not wrap without whitespace. (Supported by JS Beautify) **Example `.jsbeautifyrc` Configuration** ```json { "html": { - "unformatted": [ + "inline": [ "a", "abbr", "area", @@ -1186,21 +1165,89 @@ List of tags (defaults to inline) that should not be reformatted (Supported by J "big", "dt", "ins", - "small", "strike", - "tt", - "pre", - "h1", - "h2", - "h3", - "h4", - "h5", - "h6" + "tt" ] } } ``` +##### [Max preserve newlines](#max-preserve-newlines) + +**Namespace**: `html` + +**Key**: `max_preserve_newlines` + +**Default**: `10` + +**Type**: `integer` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Number of line-breaks to be preserved in one chunk (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "max_preserve_newlines": 10 + } +} +``` + +##### [Preserve newlines](#preserve-newlines) + +**Namespace**: `html` + +**Key**: `preserve_newlines` + +**Default**: `true` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Preserve line-breaks (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "preserve_newlines": true + } +} +``` + +##### [Unformatted](#unformatted) + +**Namespace**: `html` + +**Key**: `unformatted` + +**Type**: `array` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +(Deprecated for most scenarios - consider inline or content_unformatted) List of tags that should not be reformatted at all. NOTE: Set this to [] to get improved beautifier behavior. (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "unformatted": [] + } +} +``` + ##### [Wrap attributes](#wrap-attributes) **Namespace**: `html` @@ -1211,13 +1258,13 @@ List of tags (defaults to inline) that should not be reformatted (Supported by J **Type**: `string` -**Enum**: `auto` `force` `force-aligned` `force-expand-multiline` +**Enum**: `auto` `aligned-multiple` `force` `force-aligned` `force-expand-multiline` **Supported Beautifiers**: [`JS Beautify`](#js-beautify) **Description**: -Wrap attributes to new lines [auto|force|force-aligned|force-expand-multiline] (Supported by JS Beautify) +Wrap attributes to new lines [auto|aligned-multiple|force|force-aligned|force-expand-multiline] (Supported by JS Beautify) **Example `.jsbeautifyrc` Configuration** @@ -2635,6 +2682,7 @@ Path to uncrustify config file. i.e. uncrustify.cfg (Supported by Uncrustify) | `beautify_on_save` | :white_check_mark: | :white_check_mark: | | `brace_style` | :white_check_mark: | :x: | | `break_chained_methods` | :white_check_mark: | :white_check_mark: | +| `content_unformatted` | :white_check_mark: | :x: | | `end_of_line` | :white_check_mark: | :x: | | `end_with_comma` | :white_check_mark: | :white_check_mark: | | `end_with_newline` | :white_check_mark: | :x: | @@ -2646,6 +2694,7 @@ Path to uncrustify config file. i.e. uncrustify.cfg (Supported by Uncrustify) | `indent_scripts` | :white_check_mark: | :x: | | `indent_size` | :white_check_mark: | :white_check_mark: | | `indent_with_tabs` | :white_check_mark: | :white_check_mark: | +| `inline` | :white_check_mark: | :x: | | `jslint_happy` | :white_check_mark: | :x: | | `keep_array_indentation` | :white_check_mark: | :x: | | `keep_function_indentation` | :white_check_mark: | :x: | @@ -2772,6 +2821,35 @@ Break chained method calls across subsequent lines (Supported by JS Beautify, Pr } ``` +##### [Content unformatted](#content-unformatted) + +**Namespace**: `html` + +**Key**: `content_unformatted` + +**Default**: `pre,textarea` + +**Type**: `array` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +List of tags whose contents should not be reformatted. Attributes will be reformatted, inner html will not. (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "content_unformatted": [ + "pre", + "textarea" + ] + } +} +``` + ##### [End of line](#end-of-line) **Namespace**: `js` @@ -3054,35 +3132,98 @@ Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by J } ``` -##### [Jslint happy](#jslint-happy) +##### [Inline](#inline) -**Namespace**: `js` +**Namespace**: `html` -**Key**: `jslint_happy` +**Key**: `inline` -**Type**: `boolean` +**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,ins,strike,tt` + +**Type**: `array` **Supported Beautifiers**: [`JS Beautify`](#js-beautify) **Description**: -Enable jslint-stricter mode (Supported by JS Beautify) +List of inline tags. Behaves similar to text content, will not wrap without whitespace. (Supported by JS Beautify) **Example `.jsbeautifyrc` Configuration** ```json { - "js": { - "jslint_happy": false + "html": { + "inline": [ + "a", + "abbr", + "area", + "audio", + "b", + "bdi", + "bdo", + "br", + "button", + "canvas", + "cite", + "code", + "data", + "datalist", + "del", + "dfn", + "em", + "embed", + "i", + "iframe", + "img", + "input", + "ins", + "kbd", + "keygen", + "label", + "map", + "mark", + "math", + "meter", + "noscript", + "object", + "output", + "progress", + "q", + "ruby", + "s", + "samp", + "select", + "small", + "span", + "strong", + "sub", + "sup", + "svg", + "template", + "textarea", + "time", + "u", + "var", + "video", + "wbr", + "text", + "acronym", + "address", + "big", + "dt", + "ins", + "strike", + "tt" + ] } } ``` -##### [Keep array indentation](#keep-array-indentation) +##### [Jslint happy](#jslint-happy) **Namespace**: `js` -**Key**: `keep_array_indentation` +**Key**: `jslint_happy` **Type**: `boolean` @@ -3090,19 +3231,43 @@ Enable jslint-stricter mode (Supported by JS Beautify) **Description**: -Preserve array indentation (Supported by JS Beautify) +Enable jslint-stricter mode (Supported by JS Beautify) **Example `.jsbeautifyrc` Configuration** ```json { "js": { - "keep_array_indentation": false + "jslint_happy": false } } ``` -##### [Keep function indentation](#keep-function-indentation) +##### [Keep array indentation](#keep-array-indentation) + +**Namespace**: `js` + +**Key**: `keep_array_indentation` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Preserve array indentation (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "keep_array_indentation": false + } +} +``` + +##### [Keep function indentation](#keep-function-indentation) **Namespace**: `js` @@ -3306,91 +3471,20 @@ Decode printable characters encoded in xNN notation (Supported by JS Beautify) **Key**: `unformatted` -**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,ins,small,strike,tt,pre,h1,h2,h3,h4,h5,h6` - **Type**: `array` **Supported Beautifiers**: [`JS Beautify`](#js-beautify) **Description**: -List of tags (defaults to inline) that should not be reformatted (Supported by JS Beautify) +(Deprecated for most scenarios - consider inline or content_unformatted) List of tags that should not be reformatted at all. NOTE: Set this to [] to get improved beautifier behavior. (Supported by JS Beautify) **Example `.jsbeautifyrc` Configuration** ```json { "html": { - "unformatted": [ - "a", - "abbr", - "area", - "audio", - "b", - "bdi", - "bdo", - "br", - "button", - "canvas", - "cite", - "code", - "data", - "datalist", - "del", - "dfn", - "em", - "embed", - "i", - "iframe", - "img", - "input", - "ins", - "kbd", - "keygen", - "label", - "map", - "mark", - "math", - "meter", - "noscript", - "object", - "output", - "progress", - "q", - "ruby", - "s", - "samp", - "select", - "small", - "span", - "strong", - "sub", - "sup", - "svg", - "template", - "textarea", - "time", - "u", - "var", - "video", - "wbr", - "text", - "acronym", - "address", - "big", - "dt", - "ins", - "small", - "strike", - "tt", - "pre", - "h1", - "h2", - "h3", - "h4", - "h5", - "h6" - ] + "unformatted": [] } } ``` @@ -3405,13 +3499,13 @@ List of tags (defaults to inline) that should not be reformatted (Supported by J **Type**: `string` -**Enum**: `auto` `force` `force-aligned` `force-expand-multiline` +**Enum**: `auto` `aligned-multiple` `force` `force-aligned` `force-expand-multiline` **Supported Beautifiers**: [`JS Beautify`](#js-beautify) **Description**: -Wrap attributes to new lines [auto|force|force-aligned|force-expand-multiline] (Supported by JS Beautify) +Wrap attributes to new lines [auto|aligned-multiple|force|force-aligned|force-expand-multiline] (Supported by JS Beautify) **Example `.jsbeautifyrc` Configuration** @@ -4451,12 +4545,14 @@ Maximum characters per line (0 disables) (Supported by Pretty Diff) | `default_beautifier` | :white_check_mark: | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | :white_check_mark: | | `brace_style` | :white_check_mark: | :x: | +| `content_unformatted` | :white_check_mark: | :x: | | `end_with_newline` | :white_check_mark: | :x: | | `extra_liners` | :white_check_mark: | :x: | | `indent_char` | :white_check_mark: | :white_check_mark: | | `indent_inner_html` | :white_check_mark: | :x: | | `indent_scripts` | :white_check_mark: | :x: | | `indent_size` | :white_check_mark: | :white_check_mark: | +| `inline` | :white_check_mark: | :x: | | `max_preserve_newlines` | :white_check_mark: | :x: | | `preserve_newlines` | :white_check_mark: | :white_check_mark: | | `unformatted` | :white_check_mark: | :x: | @@ -4551,6 +4647,35 @@ Automatically beautify Handlebars files on save } ``` +##### [Content unformatted](#content-unformatted) + +**Namespace**: `html` + +**Key**: `content_unformatted` + +**Default**: `pre,textarea` + +**Type**: `array` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +List of tags whose contents should not be reformatted. Attributes will be reformatted, inner html will not. (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "content_unformatted": [ + "pre", + "textarea" + ] + } +} +``` + ##### [End with newline](#end-with-newline) **Namespace**: `html` @@ -4709,65 +4834,13 @@ Indentation size/length (Supported by JS Beautify, Pretty Diff) } ``` -##### [Max preserve newlines](#max-preserve-newlines) - -**Namespace**: `html` - -**Key**: `max_preserve_newlines` - -**Default**: `10` - -**Type**: `integer` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Number of line-breaks to be preserved in one chunk (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "max_preserve_newlines": 10 - } -} -``` - -##### [Preserve newlines](#preserve-newlines) - -**Namespace**: `html` - -**Key**: `preserve_newlines` - -**Default**: `true` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) - -**Description**: - -Preserve line-breaks (Supported by JS Beautify, Pretty Diff) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "preserve_newlines": true - } -} -``` - -##### [Unformatted](#unformatted) +##### [Inline](#inline) **Namespace**: `html` -**Key**: `unformatted` +**Key**: `inline` -**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,ins,small,strike,tt,pre,h1,h2,h3,h4,h5,h6` +**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,ins,strike,tt` **Type**: `array` @@ -4775,14 +4848,14 @@ Preserve line-breaks (Supported by JS Beautify, Pretty Diff) **Description**: -List of tags (defaults to inline) that should not be reformatted (Supported by JS Beautify) +List of inline tags. Behaves similar to text content, will not wrap without whitespace. (Supported by JS Beautify) **Example `.jsbeautifyrc` Configuration** ```json { "html": { - "unformatted": [ + "inline": [ "a", "abbr", "area", @@ -4841,21 +4914,89 @@ List of tags (defaults to inline) that should not be reformatted (Supported by J "big", "dt", "ins", - "small", "strike", - "tt", - "pre", - "h1", - "h2", - "h3", - "h4", - "h5", - "h6" + "tt" ] } } ``` +##### [Max preserve newlines](#max-preserve-newlines) + +**Namespace**: `html` + +**Key**: `max_preserve_newlines` + +**Default**: `10` + +**Type**: `integer` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Number of line-breaks to be preserved in one chunk (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "max_preserve_newlines": 10 + } +} +``` + +##### [Preserve newlines](#preserve-newlines) + +**Namespace**: `html` + +**Key**: `preserve_newlines` + +**Default**: `true` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) + +**Description**: + +Preserve line-breaks (Supported by JS Beautify, Pretty Diff) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "preserve_newlines": true + } +} +``` + +##### [Unformatted](#unformatted) + +**Namespace**: `html` + +**Key**: `unformatted` + +**Type**: `array` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +(Deprecated for most scenarios - consider inline or content_unformatted) List of tags that should not be reformatted at all. NOTE: Set this to [] to get improved beautifier behavior. (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "unformatted": [] + } +} +``` + ##### [Wrap attributes](#wrap-attributes) **Namespace**: `html` @@ -4866,13 +5007,13 @@ List of tags (defaults to inline) that should not be reformatted (Supported by J **Type**: `string` -**Enum**: `auto` `force` `force-aligned` `force-expand-multiline` +**Enum**: `auto` `aligned-multiple` `force` `force-aligned` `force-expand-multiline` **Supported Beautifiers**: [`JS Beautify`](#js-beautify) **Description**: -Wrap attributes to new lines [auto|force|force-aligned|force-expand-multiline] (Supported by JS Beautify) +Wrap attributes to new lines [auto|aligned-multiple|force|force-aligned|force-expand-multiline] (Supported by JS Beautify) **Example `.jsbeautifyrc` Configuration** @@ -5015,12 +5156,14 @@ Automatically beautify Haskell files on save | `default_beautifier` | :white_check_mark: | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | :white_check_mark: | | `brace_style` | :white_check_mark: | :x: | +| `content_unformatted` | :white_check_mark: | :x: | | `end_with_newline` | :white_check_mark: | :x: | | `extra_liners` | :white_check_mark: | :x: | | `indent_char` | :white_check_mark: | :white_check_mark: | | `indent_inner_html` | :white_check_mark: | :x: | | `indent_scripts` | :white_check_mark: | :x: | | `indent_size` | :white_check_mark: | :white_check_mark: | +| `inline` | :white_check_mark: | :x: | | `max_preserve_newlines` | :white_check_mark: | :x: | | `preserve_newlines` | :white_check_mark: | :white_check_mark: | | `unformatted` | :white_check_mark: | :x: | @@ -5115,37 +5258,66 @@ Automatically beautify HTML files on save } ``` -##### [End with newline](#end-with-newline) +##### [Content unformatted](#content-unformatted) **Namespace**: `html` -**Key**: `end_with_newline` +**Key**: `content_unformatted` -**Type**: `boolean` +**Default**: `pre,textarea` + +**Type**: `array` **Supported Beautifiers**: [`JS Beautify`](#js-beautify) **Description**: -End output with newline (Supported by JS Beautify) +List of tags whose contents should not be reformatted. Attributes will be reformatted, inner html will not. (Supported by JS Beautify) **Example `.jsbeautifyrc` Configuration** ```json { "html": { - "end_with_newline": false + "content_unformatted": [ + "pre", + "textarea" + ] } } ``` -##### [Extra liners](#extra-liners) +##### [End with newline](#end-with-newline) **Namespace**: `html` -**Key**: `extra_liners` +**Key**: `end_with_newline` -**Default**: `head,body,/html` +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +End output with newline (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "end_with_newline": false + } +} +``` + +##### [Extra liners](#extra-liners) + +**Namespace**: `html` + +**Key**: `extra_liners` + +**Default**: `head,body,/html` **Type**: `array` @@ -5273,65 +5445,13 @@ Indentation size/length (Supported by JS Beautify, Pretty Diff) } ``` -##### [Max preserve newlines](#max-preserve-newlines) +##### [Inline](#inline) **Namespace**: `html` -**Key**: `max_preserve_newlines` +**Key**: `inline` -**Default**: `10` - -**Type**: `integer` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Number of line-breaks to be preserved in one chunk (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "max_preserve_newlines": 10 - } -} -``` - -##### [Preserve newlines](#preserve-newlines) - -**Namespace**: `html` - -**Key**: `preserve_newlines` - -**Default**: `true` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) - -**Description**: - -Preserve line-breaks (Supported by JS Beautify, Pretty Diff) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "preserve_newlines": true - } -} -``` - -##### [Unformatted](#unformatted) - -**Namespace**: `html` - -**Key**: `unformatted` - -**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,ins,small,strike,tt,pre,h1,h2,h3,h4,h5,h6` +**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,ins,strike,tt` **Type**: `array` @@ -5339,14 +5459,14 @@ Preserve line-breaks (Supported by JS Beautify, Pretty Diff) **Description**: -List of tags (defaults to inline) that should not be reformatted (Supported by JS Beautify) +List of inline tags. Behaves similar to text content, will not wrap without whitespace. (Supported by JS Beautify) **Example `.jsbeautifyrc` Configuration** ```json { "html": { - "unformatted": [ + "inline": [ "a", "abbr", "area", @@ -5405,21 +5525,89 @@ List of tags (defaults to inline) that should not be reformatted (Supported by J "big", "dt", "ins", - "small", "strike", - "tt", - "pre", - "h1", - "h2", - "h3", - "h4", - "h5", - "h6" + "tt" ] } } ``` +##### [Max preserve newlines](#max-preserve-newlines) + +**Namespace**: `html` + +**Key**: `max_preserve_newlines` + +**Default**: `10` + +**Type**: `integer` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Number of line-breaks to be preserved in one chunk (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "max_preserve_newlines": 10 + } +} +``` + +##### [Preserve newlines](#preserve-newlines) + +**Namespace**: `html` + +**Key**: `preserve_newlines` + +**Default**: `true` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) + +**Description**: + +Preserve line-breaks (Supported by JS Beautify, Pretty Diff) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "preserve_newlines": true + } +} +``` + +##### [Unformatted](#unformatted) + +**Namespace**: `html` + +**Key**: `unformatted` + +**Type**: `array` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +(Deprecated for most scenarios - consider inline or content_unformatted) List of tags that should not be reformatted at all. NOTE: Set this to [] to get improved beautifier behavior. (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "unformatted": [] + } +} +``` + ##### [Wrap attributes](#wrap-attributes) **Namespace**: `html` @@ -5430,13 +5618,13 @@ List of tags (defaults to inline) that should not be reformatted (Supported by J **Type**: `string` -**Enum**: `auto` `force` `force-aligned` `force-expand-multiline` +**Enum**: `auto` `aligned-multiple` `force` `force-aligned` `force-expand-multiline` **Supported Beautifiers**: [`JS Beautify`](#js-beautify) **Description**: -Wrap attributes to new lines [auto|force|force-aligned|force-expand-multiline] (Supported by JS Beautify) +Wrap attributes to new lines [auto|aligned-multiple|force|force-aligned|force-expand-multiline] (Supported by JS Beautify) **Example `.jsbeautifyrc` Configuration** @@ -8530,12 +8718,14 @@ Enables raw YAML front matter to be detected (thus ignoring markdown-like syntax | `default_beautifier` | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | | `brace_style` | :white_check_mark: | +| `content_unformatted` | :white_check_mark: | | `end_with_newline` | :white_check_mark: | | `extra_liners` | :white_check_mark: | | `indent_char` | :white_check_mark: | | `indent_inner_html` | :white_check_mark: | | `indent_scripts` | :white_check_mark: | | `indent_size` | :white_check_mark: | +| `inline` | :white_check_mark: | | `max_preserve_newlines` | :white_check_mark: | | `preserve_newlines` | :white_check_mark: | | `syntax` | :white_check_mark: | @@ -8631,6 +8821,35 @@ Automatically beautify Marko files on save } ``` +##### [Content unformatted](#content-unformatted) + +**Namespace**: `html` + +**Key**: `content_unformatted` + +**Default**: `pre,textarea` + +**Type**: `array` + +**Supported Beautifiers**: [`Marko Beautifier`](#marko-beautifier) + +**Description**: + +List of tags whose contents should not be reformatted. Attributes will be reformatted, inner html will not. (Supported by Marko Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "content_unformatted": [ + "pre", + "textarea" + ] + } +} +``` + ##### [End with newline](#end-with-newline) **Namespace**: `html` @@ -8789,6 +9008,93 @@ Indentation size/length (Supported by Marko Beautifier) } ``` +##### [Inline](#inline) + +**Namespace**: `html` + +**Key**: `inline` + +**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,ins,strike,tt` + +**Type**: `array` + +**Supported Beautifiers**: [`Marko Beautifier`](#marko-beautifier) + +**Description**: + +List of inline tags. Behaves similar to text content, will not wrap without whitespace. (Supported by Marko Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "inline": [ + "a", + "abbr", + "area", + "audio", + "b", + "bdi", + "bdo", + "br", + "button", + "canvas", + "cite", + "code", + "data", + "datalist", + "del", + "dfn", + "em", + "embed", + "i", + "iframe", + "img", + "input", + "ins", + "kbd", + "keygen", + "label", + "map", + "mark", + "math", + "meter", + "noscript", + "object", + "output", + "progress", + "q", + "ruby", + "s", + "samp", + "select", + "small", + "span", + "strong", + "sub", + "sup", + "svg", + "template", + "textarea", + "time", + "u", + "var", + "video", + "wbr", + "text", + "acronym", + "address", + "big", + "dt", + "ins", + "strike", + "tt" + ] + } +} +``` + ##### [Max preserve newlines](#max-preserve-newlines) **Namespace**: `html` @@ -8875,91 +9181,20 @@ Preserve line-breaks (Supported by Marko Beautifier) **Key**: `unformatted` -**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,ins,small,strike,tt,pre,h1,h2,h3,h4,h5,h6` - **Type**: `array` **Supported Beautifiers**: [`Marko Beautifier`](#marko-beautifier) **Description**: -List of tags (defaults to inline) that should not be reformatted (Supported by Marko Beautifier) +(Deprecated for most scenarios - consider inline or content_unformatted) List of tags that should not be reformatted at all. NOTE: Set this to [] to get improved beautifier behavior. (Supported by Marko Beautifier) **Example `.jsbeautifyrc` Configuration** ```json { "html": { - "unformatted": [ - "a", - "abbr", - "area", - "audio", - "b", - "bdi", - "bdo", - "br", - "button", - "canvas", - "cite", - "code", - "data", - "datalist", - "del", - "dfn", - "em", - "embed", - "i", - "iframe", - "img", - "input", - "ins", - "kbd", - "keygen", - "label", - "map", - "mark", - "math", - "meter", - "noscript", - "object", - "output", - "progress", - "q", - "ruby", - "s", - "samp", - "select", - "small", - "span", - "strong", - "sub", - "sup", - "svg", - "template", - "textarea", - "time", - "u", - "var", - "video", - "wbr", - "text", - "acronym", - "address", - "big", - "dt", - "ins", - "small", - "strike", - "tt", - "pre", - "h1", - "h2", - "h3", - "h4", - "h5", - "h6" - ] + "unformatted": [] } } ``` @@ -8974,13 +9209,13 @@ List of tags (defaults to inline) that should not be reformatted (Supported by M **Type**: `string` -**Enum**: `auto` `force` `force-aligned` `force-expand-multiline` +**Enum**: `auto` `aligned-multiple` `force` `force-aligned` `force-expand-multiline` **Supported Beautifiers**: [`Marko Beautifier`](#marko-beautifier) **Description**: -Wrap attributes to new lines [auto|force|force-aligned|force-expand-multiline] (Supported by Marko Beautifier) +Wrap attributes to new lines [auto|aligned-multiple|force|force-aligned|force-expand-multiline] (Supported by Marko Beautifier) **Example `.jsbeautifyrc` Configuration** @@ -9054,12 +9289,14 @@ Maximum characters per line (0 disables) (Supported by Marko Beautifier) | `default_beautifier` | :white_check_mark: | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | :white_check_mark: | | `brace_style` | :white_check_mark: | :x: | +| `content_unformatted` | :white_check_mark: | :x: | | `end_with_newline` | :white_check_mark: | :x: | | `extra_liners` | :white_check_mark: | :x: | | `indent_char` | :white_check_mark: | :white_check_mark: | | `indent_inner_html` | :white_check_mark: | :x: | | `indent_scripts` | :white_check_mark: | :x: | | `indent_size` | :white_check_mark: | :white_check_mark: | +| `inline` | :white_check_mark: | :x: | | `max_preserve_newlines` | :white_check_mark: | :x: | | `preserve_newlines` | :white_check_mark: | :white_check_mark: | | `unformatted` | :white_check_mark: | :x: | @@ -9154,6 +9391,35 @@ Automatically beautify Mustache files on save } ``` +##### [Content unformatted](#content-unformatted) + +**Namespace**: `html` + +**Key**: `content_unformatted` + +**Default**: `pre,textarea` + +**Type**: `array` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +List of tags whose contents should not be reformatted. Attributes will be reformatted, inner html will not. (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "content_unformatted": [ + "pre", + "textarea" + ] + } +} +``` + ##### [End with newline](#end-with-newline) **Namespace**: `html` @@ -9312,65 +9578,13 @@ Indentation size/length (Supported by JS Beautify, Pretty Diff) } ``` -##### [Max preserve newlines](#max-preserve-newlines) +##### [Inline](#inline) **Namespace**: `html` -**Key**: `max_preserve_newlines` +**Key**: `inline` -**Default**: `10` - -**Type**: `integer` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -Number of line-breaks to be preserved in one chunk (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "max_preserve_newlines": 10 - } -} -``` - -##### [Preserve newlines](#preserve-newlines) - -**Namespace**: `html` - -**Key**: `preserve_newlines` - -**Default**: `true` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) - -**Description**: - -Preserve line-breaks (Supported by JS Beautify, Pretty Diff) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "preserve_newlines": true - } -} -``` - -##### [Unformatted](#unformatted) - -**Namespace**: `html` - -**Key**: `unformatted` - -**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,strike,tt,pre,h1,h2,h3,h4,h5,h6` +**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,strike,tt` **Type**: `array` @@ -9378,14 +9592,14 @@ Preserve line-breaks (Supported by JS Beautify, Pretty Diff) **Description**: -List of tags (defaults to inline) that should not be reformatted (Supported by JS Beautify) +List of inline tags. Behaves similar to text content, will not wrap without whitespace. (Supported by JS Beautify) **Example `.jsbeautifyrc` Configuration** ```json { "html": { - "unformatted": [ + "inline": [ "a", "abbr", "area", @@ -9444,19 +9658,88 @@ List of tags (defaults to inline) that should not be reformatted (Supported by J "big", "dt", "strike", - "tt", - "pre", - "h1", - "h2", - "h3", - "h4", - "h5", - "h6" + "tt" ] } } ``` +##### [Max preserve newlines](#max-preserve-newlines) + +**Namespace**: `html` + +**Key**: `max_preserve_newlines` + +**Default**: `10` + +**Type**: `integer` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Number of line-breaks to be preserved in one chunk (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "max_preserve_newlines": 10 + } +} +``` + +##### [Preserve newlines](#preserve-newlines) + +**Namespace**: `html` + +**Key**: `preserve_newlines` + +**Default**: `true` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) + +**Description**: + +Preserve line-breaks (Supported by JS Beautify, Pretty Diff) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "preserve_newlines": true + } +} +``` + +##### [Unformatted](#unformatted) + +**Namespace**: `html` + +**Key**: `unformatted` + +**Type**: `array` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +(Deprecated for most scenarios - consider inline or content_unformatted) List of tags that should not be reformatted at all. NOTE: Set this to [] to get improved beautifier behavior. (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "unformatted": [] + } +} +``` + ##### [Wrap attributes](#wrap-attributes) **Namespace**: `html` @@ -9467,13 +9750,13 @@ List of tags (defaults to inline) that should not be reformatted (Supported by J **Type**: `string` -**Enum**: `auto` `force` `force-aligned` `force-expand-multiline` +**Enum**: `auto` `aligned-multiple` `force` `force-aligned` `force-expand-multiline` **Supported Beautifiers**: [`JS Beautify`](#js-beautify) **Description**: -Wrap attributes to new lines [auto|force|force-aligned|force-expand-multiline] (Supported by JS Beautify) +Wrap attributes to new lines [auto|aligned-multiple|force|force-aligned|force-expand-multiline] (Supported by JS Beautify) **Example `.jsbeautifyrc` Configuration** @@ -14178,6 +14461,7 @@ Maximum characters per line (0 disables) (Supported by Pretty Diff) | `beautify_on_save` | :white_check_mark: | :white_check_mark: | :white_check_mark: | | `brace_style` | :x: | :x: | :white_check_mark: | | `break_chained_methods` | :x: | :x: | :white_check_mark: | +| `content_unformatted` | :x: | :x: | :white_check_mark: | | `end_of_line` | :x: | :x: | :white_check_mark: | | `end_with_comma` | :x: | :x: | :white_check_mark: | | `end_with_newline` | :x: | :x: | :white_check_mark: | @@ -14189,6 +14473,7 @@ Maximum characters per line (0 disables) (Supported by Pretty Diff) | `indent_scripts` | :x: | :x: | :white_check_mark: | | `indent_size` | :x: | :x: | :white_check_mark: | | `indent_with_tabs` | :x: | :x: | :white_check_mark: | +| `inline` | :x: | :x: | :white_check_mark: | | `jslint_happy` | :x: | :x: | :white_check_mark: | | `keep_array_indentation` | :x: | :x: | :white_check_mark: | | `keep_function_indentation` | :x: | :x: | :white_check_mark: | @@ -14315,6 +14600,35 @@ Break chained method calls across subsequent lines (Supported by Vue Beautifier) } ``` +##### [Content unformatted](#content-unformatted) + +**Namespace**: `html` + +**Key**: `content_unformatted` + +**Default**: `pre,textarea` + +**Type**: `array` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +List of tags whose contents should not be reformatted. Attributes will be reformatted, inner html will not. (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "content_unformatted": [ + "pre", + "textarea" + ] + } +} +``` + ##### [End of line](#end-of-line) **Namespace**: `js` @@ -14597,6 +14911,93 @@ Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by V } ``` +##### [Inline](#inline) + +**Namespace**: `html` + +**Key**: `inline` + +**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,ins,strike,tt` + +**Type**: `array` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +List of inline tags. Behaves similar to text content, will not wrap without whitespace. (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "inline": [ + "a", + "abbr", + "area", + "audio", + "b", + "bdi", + "bdo", + "br", + "button", + "canvas", + "cite", + "code", + "data", + "datalist", + "del", + "dfn", + "em", + "embed", + "i", + "iframe", + "img", + "input", + "ins", + "kbd", + "keygen", + "label", + "map", + "mark", + "math", + "meter", + "noscript", + "object", + "output", + "progress", + "q", + "ruby", + "s", + "samp", + "select", + "small", + "span", + "strong", + "sub", + "sup", + "svg", + "template", + "textarea", + "time", + "u", + "var", + "video", + "wbr", + "text", + "acronym", + "address", + "big", + "dt", + "ins", + "strike", + "tt" + ] + } +} +``` + ##### [Jslint happy](#jslint-happy) **Namespace**: `js` @@ -14849,91 +15250,20 @@ Decode printable characters encoded in xNN notation (Supported by Vue Beautifier **Key**: `unformatted` -**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,ins,small,strike,tt,pre,h1,h2,h3,h4,h5,h6` - **Type**: `array` **Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) **Description**: -List of tags (defaults to inline) that should not be reformatted (Supported by Vue Beautifier) +(Deprecated for most scenarios - consider inline or content_unformatted) List of tags that should not be reformatted at all. NOTE: Set this to [] to get improved beautifier behavior. (Supported by Vue Beautifier) **Example `.jsbeautifyrc` Configuration** ```json { "html": { - "unformatted": [ - "a", - "abbr", - "area", - "audio", - "b", - "bdi", - "bdo", - "br", - "button", - "canvas", - "cite", - "code", - "data", - "datalist", - "del", - "dfn", - "em", - "embed", - "i", - "iframe", - "img", - "input", - "ins", - "kbd", - "keygen", - "label", - "map", - "mark", - "math", - "meter", - "noscript", - "object", - "output", - "progress", - "q", - "ruby", - "s", - "samp", - "select", - "small", - "span", - "strong", - "sub", - "sup", - "svg", - "template", - "textarea", - "time", - "u", - "var", - "video", - "wbr", - "text", - "acronym", - "address", - "big", - "dt", - "ins", - "small", - "strike", - "tt", - "pre", - "h1", - "h2", - "h3", - "h4", - "h5", - "h6" - ] + "unformatted": [] } } ``` @@ -14948,13 +15278,13 @@ List of tags (defaults to inline) that should not be reformatted (Supported by V **Type**: `string` -**Enum**: `auto` `force` `force-aligned` `force-expand-multiline` +**Enum**: `auto` `aligned-multiple` `force` `force-aligned` `force-expand-multiline` **Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) **Description**: -Wrap attributes to new lines [auto|force|force-aligned|force-expand-multiline] (Supported by Vue Beautifier) +Wrap attributes to new lines [auto|aligned-multiple|force|force-aligned|force-expand-multiline] (Supported by Vue Beautifier) **Example `.jsbeautifyrc` Configuration** @@ -15028,12 +15358,14 @@ Maximum characters per line (0 disables) (Supported by Vue Beautifier) | `default_beautifier` | :white_check_mark: | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | :white_check_mark: | | `brace_style` | :white_check_mark: | :x: | +| `content_unformatted` | :white_check_mark: | :x: | | `end_with_newline` | :white_check_mark: | :x: | | `extra_liners` | :white_check_mark: | :x: | | `indent_char` | :white_check_mark: | :white_check_mark: | | `indent_inner_html` | :white_check_mark: | :x: | | `indent_scripts` | :white_check_mark: | :x: | | `indent_size` | :white_check_mark: | :white_check_mark: | +| `inline` | :white_check_mark: | :x: | | `max_preserve_newlines` | :white_check_mark: | :x: | | `preserve_newlines` | :white_check_mark: | :white_check_mark: | | `unformatted` | :white_check_mark: | :x: | @@ -15128,37 +15460,13 @@ Automatically beautify XML files on save } ``` -##### [End with newline](#end-with-newline) - -**Namespace**: `html` - -**Key**: `end_with_newline` - -**Type**: `boolean` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) - -**Description**: - -End output with newline (Supported by JS Beautify) - -**Example `.jsbeautifyrc` Configuration** - -```json -{ - "html": { - "end_with_newline": false - } -} -``` - -##### [Extra liners](#extra-liners) +##### [Content unformatted](#content-unformatted) **Namespace**: `html` -**Key**: `extra_liners` +**Key**: `content_unformatted` -**Default**: `head,body,/html` +**Default**: `pre,textarea` **Type**: `array` @@ -15166,185 +15474,186 @@ End output with newline (Supported by JS Beautify) **Description**: -List of tags (defaults to [head,body,/html] that should have an extra newline before them. (Supported by JS Beautify) +List of tags whose contents should not be reformatted. Attributes will be reformatted, inner html will not. (Supported by JS Beautify) **Example `.jsbeautifyrc` Configuration** ```json { "html": { - "extra_liners": [ - "head", - "body", - "/html" + "content_unformatted": [ + "pre", + "textarea" ] } } ``` -##### [Indent char](#indent-char) +##### [End with newline](#end-with-newline) **Namespace**: `html` -**Key**: `indent_char` - -**Default**: ` ` +**Key**: `end_with_newline` -**Type**: `string` +**Type**: `boolean` -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) **Description**: -Indentation character (Supported by JS Beautify, Pretty Diff) +End output with newline (Supported by JS Beautify) **Example `.jsbeautifyrc` Configuration** ```json { "html": { - "indent_char": " " + "end_with_newline": false } } ``` -##### [Indent inner html](#indent-inner-html) +##### [Extra liners](#extra-liners) **Namespace**: `html` -**Key**: `indent_inner_html` +**Key**: `extra_liners` -**Type**: `boolean` +**Default**: `head,body,/html` + +**Type**: `array` **Supported Beautifiers**: [`JS Beautify`](#js-beautify) **Description**: -Indent and sections. (Supported by JS Beautify) +List of tags (defaults to [head,body,/html] that should have an extra newline before them. (Supported by JS Beautify) **Example `.jsbeautifyrc` Configuration** ```json { "html": { - "indent_inner_html": false + "extra_liners": [ + "head", + "body", + "/html" + ] } } ``` -##### [Indent scripts](#indent-scripts) +##### [Indent char](#indent-char) **Namespace**: `html` -**Key**: `indent_scripts` +**Key**: `indent_char` -**Default**: `normal` +**Default**: ` ` **Type**: `string` -**Enum**: `keep` `separate` `normal` - -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) **Description**: -[keep|separate|normal] (Supported by JS Beautify) +Indentation character (Supported by JS Beautify, Pretty Diff) **Example `.jsbeautifyrc` Configuration** ```json { "html": { - "indent_scripts": "normal" + "indent_char": " " } } ``` -##### [Indent size](#indent-size) +##### [Indent inner html](#indent-inner-html) **Namespace**: `html` -**Key**: `indent_size` - -**Default**: `4` +**Key**: `indent_inner_html` -**Type**: `integer` +**Type**: `boolean` -**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) **Description**: -Indentation size/length (Supported by JS Beautify, Pretty Diff) +Indent and sections. (Supported by JS Beautify) **Example `.jsbeautifyrc` Configuration** ```json { "html": { - "indent_size": 4 + "indent_inner_html": false } } ``` -##### [Max preserve newlines](#max-preserve-newlines) +##### [Indent scripts](#indent-scripts) **Namespace**: `html` -**Key**: `max_preserve_newlines` +**Key**: `indent_scripts` -**Default**: `10` +**Default**: `normal` -**Type**: `integer` +**Type**: `string` + +**Enum**: `keep` `separate` `normal` **Supported Beautifiers**: [`JS Beautify`](#js-beautify) **Description**: -Number of line-breaks to be preserved in one chunk (Supported by JS Beautify) +[keep|separate|normal] (Supported by JS Beautify) **Example `.jsbeautifyrc` Configuration** ```json { "html": { - "max_preserve_newlines": 10 + "indent_scripts": "normal" } } ``` -##### [Preserve newlines](#preserve-newlines) +##### [Indent size](#indent-size) **Namespace**: `html` -**Key**: `preserve_newlines` +**Key**: `indent_size` -**Default**: `true` +**Default**: `4` -**Type**: `boolean` +**Type**: `integer` **Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) **Description**: -Preserve line-breaks (Supported by JS Beautify, Pretty Diff) +Indentation size/length (Supported by JS Beautify, Pretty Diff) **Example `.jsbeautifyrc` Configuration** ```json { "html": { - "preserve_newlines": true + "indent_size": 4 } } ``` -##### [Unformatted](#unformatted) +##### [Inline](#inline) **Namespace**: `html` -**Key**: `unformatted` +**Key**: `inline` -**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,ins,small,strike,tt,pre,h1,h2,h3,h4,h5,h6` +**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,ins,strike,tt` **Type**: `array` @@ -15352,14 +15661,14 @@ Preserve line-breaks (Supported by JS Beautify, Pretty Diff) **Description**: -List of tags (defaults to inline) that should not be reformatted (Supported by JS Beautify) +List of inline tags. Behaves similar to text content, will not wrap without whitespace. (Supported by JS Beautify) **Example `.jsbeautifyrc` Configuration** ```json { "html": { - "unformatted": [ + "inline": [ "a", "abbr", "area", @@ -15418,21 +15727,89 @@ List of tags (defaults to inline) that should not be reformatted (Supported by J "big", "dt", "ins", - "small", "strike", - "tt", - "pre", - "h1", - "h2", - "h3", - "h4", - "h5", - "h6" + "tt" ] } } ``` +##### [Max preserve newlines](#max-preserve-newlines) + +**Namespace**: `html` + +**Key**: `max_preserve_newlines` + +**Default**: `10` + +**Type**: `integer` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +Number of line-breaks to be preserved in one chunk (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "max_preserve_newlines": 10 + } +} +``` + +##### [Preserve newlines](#preserve-newlines) + +**Namespace**: `html` + +**Key**: `preserve_newlines` + +**Default**: `true` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) + +**Description**: + +Preserve line-breaks (Supported by JS Beautify, Pretty Diff) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "preserve_newlines": true + } +} +``` + +##### [Unformatted](#unformatted) + +**Namespace**: `html` + +**Key**: `unformatted` + +**Type**: `array` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +(Deprecated for most scenarios - consider inline or content_unformatted) List of tags that should not be reformatted at all. NOTE: Set this to [] to get improved beautifier behavior. (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "unformatted": [] + } +} +``` + ##### [Wrap attributes](#wrap-attributes) **Namespace**: `html` @@ -15443,13 +15820,13 @@ List of tags (defaults to inline) that should not be reformatted (Supported by J **Type**: `string` -**Enum**: `auto` `force` `force-aligned` `force-expand-multiline` +**Enum**: `auto` `aligned-multiple` `force` `force-aligned` `force-expand-multiline` **Supported Beautifiers**: [`JS Beautify`](#js-beautify) **Description**: -Wrap attributes to new lines [auto|force|force-aligned|force-expand-multiline] (Supported by JS Beautify) +Wrap attributes to new lines [auto|aligned-multiple|force|force-aligned|force-expand-multiline] (Supported by JS Beautify) **Example `.jsbeautifyrc` Configuration** @@ -16178,13 +16555,13 @@ Maximum characters per line (0 disables) (Supported by JS Beautify, Pretty Diff) **Type**: `string` -**Enum**: `auto` `force` `force-aligned` `force-expand-multiline` +**Enum**: `auto` `aligned-multiple` `force` `force-aligned` `force-expand-multiline` **Supported Beautifiers**: [`JS Beautify`](#js-beautify) **Description**: -Wrap attributes to new lines [auto|force|force-aligned|force-expand-multiline] (Supported by JS Beautify) +Wrap attributes to new lines [auto|aligned-multiple|force|force-aligned|force-expand-multiline] (Supported by JS Beautify) **Example `.jsbeautifyrc` Configuration** @@ -16280,7 +16657,31 @@ Number of line-breaks to be preserved in one chunk (Supported by JS Beautify) **Key**: `unformatted` -**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,ins,small,strike,tt,pre,h1,h2,h3,h4,h5,h6` +**Type**: `array` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +(Deprecated for most scenarios - consider inline or content_unformatted) List of tags that should not be reformatted at all. NOTE: Set this to [] to get improved beautifier behavior. (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "unformatted": [] + } +} +``` + +##### [Inline](#inline) + +**Namespace**: `html` + +**Key**: `inline` + +**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,ins,strike,tt` **Type**: `array` @@ -16288,14 +16689,14 @@ Number of line-breaks to be preserved in one chunk (Supported by JS Beautify) **Description**: -List of tags (defaults to inline) that should not be reformatted (Supported by JS Beautify) +List of inline tags. Behaves similar to text content, will not wrap without whitespace. (Supported by JS Beautify) **Example `.jsbeautifyrc` Configuration** ```json { "html": { - "unformatted": [ + "inline": [ "a", "abbr", "area", @@ -16354,16 +16755,37 @@ List of tags (defaults to inline) that should not be reformatted (Supported by J "big", "dt", "ins", - "small", "strike", - "tt", + "tt" + ] + } +} +``` + +##### [Content unformatted](#content-unformatted) + +**Namespace**: `html` + +**Key**: `content_unformatted` + +**Default**: `pre,textarea` + +**Type**: `array` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) + +**Description**: + +List of tags whose contents should not be reformatted. Attributes will be reformatted, inner html will not. (Supported by JS Beautify) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "content_unformatted": [ "pre", - "h1", - "h2", - "h3", - "h4", - "h5", - "h6" + "textarea" ] } } @@ -17305,13 +17727,13 @@ Maximum characters per line (0 disables) (Supported by Marko Beautifier) **Type**: `string` -**Enum**: `auto` `force` `force-aligned` `force-expand-multiline` +**Enum**: `auto` `aligned-multiple` `force` `force-aligned` `force-expand-multiline` **Supported Beautifiers**: [`Marko Beautifier`](#marko-beautifier) **Description**: -Wrap attributes to new lines [auto|force|force-aligned|force-expand-multiline] (Supported by Marko Beautifier) +Wrap attributes to new lines [auto|aligned-multiple|force|force-aligned|force-expand-multiline] (Supported by Marko Beautifier) **Example `.jsbeautifyrc` Configuration** @@ -17407,7 +17829,31 @@ Number of line-breaks to be preserved in one chunk (Supported by Marko Beautifie **Key**: `unformatted` -**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,ins,small,strike,tt,pre,h1,h2,h3,h4,h5,h6` +**Type**: `array` + +**Supported Beautifiers**: [`Marko Beautifier`](#marko-beautifier) + +**Description**: + +(Deprecated for most scenarios - consider inline or content_unformatted) List of tags that should not be reformatted at all. NOTE: Set this to [] to get improved beautifier behavior. (Supported by Marko Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "unformatted": [] + } +} +``` + +##### [Inline](#inline) + +**Namespace**: `html` + +**Key**: `inline` + +**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,ins,strike,tt` **Type**: `array` @@ -17415,14 +17861,14 @@ Number of line-breaks to be preserved in one chunk (Supported by Marko Beautifie **Description**: -List of tags (defaults to inline) that should not be reformatted (Supported by Marko Beautifier) +List of inline tags. Behaves similar to text content, will not wrap without whitespace. (Supported by Marko Beautifier) **Example `.jsbeautifyrc` Configuration** ```json { "html": { - "unformatted": [ + "inline": [ "a", "abbr", "area", @@ -17481,16 +17927,37 @@ List of tags (defaults to inline) that should not be reformatted (Supported by M "big", "dt", "ins", - "small", "strike", - "tt", + "tt" + ] + } +} +``` + +##### [Content unformatted](#content-unformatted) + +**Namespace**: `html` + +**Key**: `content_unformatted` + +**Default**: `pre,textarea` + +**Type**: `array` + +**Supported Beautifiers**: [`Marko Beautifier`](#marko-beautifier) + +**Description**: + +List of tags whose contents should not be reformatted. Attributes will be reformatted, inner html will not. (Supported by Marko Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "content_unformatted": [ "pre", - "h1", - "h2", - "h3", - "h4", - "h5", - "h6" + "textarea" ] } } @@ -19364,13 +19831,13 @@ Indent and sections. (Supported by Vue Beautifier) **Type**: `string` -**Enum**: `auto` `force` `force-aligned` `force-expand-multiline` +**Enum**: `auto` `aligned-multiple` `force` `force-aligned` `force-expand-multiline` **Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) **Description**: -Wrap attributes to new lines [auto|force|force-aligned|force-expand-multiline] (Supported by Vue Beautifier) +Wrap attributes to new lines [auto|aligned-multiple|force|force-aligned|force-expand-multiline] (Supported by Vue Beautifier) **Example `.jsbeautifyrc` Configuration** @@ -19414,7 +19881,31 @@ Indent wrapped attributes to after N characters (Supported by Vue Beautifier) **Key**: `unformatted` -**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,ins,small,strike,tt,pre,h1,h2,h3,h4,h5,h6` +**Type**: `array` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +(Deprecated for most scenarios - consider inline or content_unformatted) List of tags that should not be reformatted at all. NOTE: Set this to [] to get improved beautifier behavior. (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "unformatted": [] + } +} +``` + +##### [Inline](#inline) + +**Namespace**: `html` + +**Key**: `inline` + +**Default**: `a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,ins,strike,tt` **Type**: `array` @@ -19422,14 +19913,14 @@ Indent wrapped attributes to after N characters (Supported by Vue Beautifier) **Description**: -List of tags (defaults to inline) that should not be reformatted (Supported by Vue Beautifier) +List of inline tags. Behaves similar to text content, will not wrap without whitespace. (Supported by Vue Beautifier) **Example `.jsbeautifyrc` Configuration** ```json { "html": { - "unformatted": [ + "inline": [ "a", "abbr", "area", @@ -19488,16 +19979,37 @@ List of tags (defaults to inline) that should not be reformatted (Supported by V "big", "dt", "ins", - "small", "strike", - "tt", + "tt" + ] + } +} +``` + +##### [Content unformatted](#content-unformatted) + +**Namespace**: `html` + +**Key**: `content_unformatted` + +**Default**: `pre,textarea` + +**Type**: `array` + +**Supported Beautifiers**: [`Vue Beautifier`](#vue-beautifier) + +**Description**: + +List of tags whose contents should not be reformatted. Attributes will be reformatted, inner html will not. (Supported by Vue Beautifier) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "html": { + "content_unformatted": [ "pre", - "h1", - "h2", - "h3", - "h4", - "h5", - "h6" + "textarea" ] } } diff --git a/examples/nested-jsbeautifyrc/twig/expected/test.twig b/examples/nested-jsbeautifyrc/twig/expected/test.twig index c6e64977a..39ca44b39 100644 --- a/examples/nested-jsbeautifyrc/twig/expected/test.twig +++ b/examples/nested-jsbeautifyrc/twig/expected/test.twig @@ -12,7 +12,8 @@ {% endfor %} -

My Webpage

{{ a_variable }} +

My Webpage

+ {{ a_variable }} \ No newline at end of file diff --git a/examples/simple-jsbeautifyrc/blade/expected/test.blade.php b/examples/simple-jsbeautifyrc/blade/expected/test.blade.php index 821d1b44c..57831b855 100644 --- a/examples/simple-jsbeautifyrc/blade/expected/test.blade.php +++ b/examples/simple-jsbeautifyrc/blade/expected/test.blade.php @@ -5,7 +5,8 @@ - @section('sidebar') This is the {{ $mater }} sidebar. + @section('sidebar') + This is the {{ $mater }} sidebar. @show
@@ -13,7 +14,8 @@
@component('alert') - @slot('title') Forbidden + @slot('title') + Forbidden @endslot Whoops! Something went wrong! @endcomponent diff --git a/package-lock.json b/package-lock.json index 19a3d805d..079bc0dd8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "atom-beautify", - "version": "0.33.0", + "version": "0.33.1", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -2344,36 +2344,16 @@ "integrity": "sha1-IoveaYoMYUMdwmMKahVPFYkNIxc=" }, "js-beautify": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/js-beautify/-/js-beautify-1.7.5.tgz", - "integrity": "sha512-9OhfAqGOrD7hoQBLJMTA+BKuKmoEtTJXzZ7WDF/9gvjtey1koVLuZqIY6c51aPDjbNdNtIXAkiWKVhziawE9Og==", + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/js-beautify/-/js-beautify-1.8.1.tgz", + "integrity": "sha512-e6Ij+fcwlnhxwfEWH148AV240ocW6z6LTZtWc9V7QEOUMu7pe2EINYbO1sM4GPHFwTVWMUWBCXGgsJGRpaQPLQ==", "requires": { "config-chain": "~1.1.5", - "editorconfig": "^0.13.2", + "editorconfig": "^0.15.0", "mkdirp": "~0.5.0", - "nopt": "~3.0.1" + "nopt": "~4.0.1" }, "dependencies": { - "editorconfig": { - "version": "0.13.3", - "resolved": "https://registry.npmjs.org/editorconfig/-/editorconfig-0.13.3.tgz", - "integrity": "sha512-WkjsUNVCu+ITKDj73QDvi0trvpdDWdkDyHybDGSXPfekLCqwmpD7CP7iPbvBgosNuLcI96XTDwNa75JyFl7tEQ==", - "requires": { - "bluebird": "^3.0.5", - "commander": "^2.9.0", - "lru-cache": "^3.2.0", - "semver": "^5.1.0", - "sigmund": "^1.0.1" - } - }, - "lru-cache": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-3.2.0.tgz", - "integrity": "sha1-cXibO39Tmb7IVl3aOKow0qCX7+4=", - "requires": { - "pseudomap": "^1.0.1" - } - }, "minimist": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", @@ -2895,11 +2875,12 @@ } }, "nopt": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", - "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.1.tgz", + "integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=", "requires": { - "abbrev": "1" + "abbrev": "1", + "osenv": "^0.1.4" } }, "npm-prefix": { @@ -3011,6 +2992,15 @@ "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=" }, + "osenv": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", + "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", + "requires": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + } + }, "p-finally": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", diff --git a/package.json b/package.json index ed1e8a1f7..656e21b48 100644 --- a/package.json +++ b/package.json @@ -168,6 +168,10 @@ { "name": "Kohei Hiraga", "url": "https://github.com/range3" + }, + { + "name": "Liam Newman", + "url": "https://github.com/bitwiseman" } ], "engines": { @@ -191,7 +195,7 @@ "extend": "^3.0.1", "gherkin": "^2.12.2", "handlebars": "^4.0.11", - "js-beautify": "~1.7.5", + "js-beautify": "^1.8.1", "jscs": "^3.0.7", "lodash": "^4.17.4", "loophole": "^1.1.0", @@ -484,4 +488,4 @@ "prettydiff2" ] } -} +} \ No newline at end of file diff --git a/src/beautifiers/js-beautify.coffee b/src/beautifiers/js-beautify.coffee index 01e377cdc..ccac1bc3a 100644 --- a/src/beautifiers/js-beautify.coffee +++ b/src/beautifiers/js-beautify.coffee @@ -55,10 +55,10 @@ module.exports = class JSBeautify extends Beautifier when "Blade" beautifyHTML = require("js-beautify").html # pre script (Workaround) - text = text.replace(/\@(?!yield)([^\n\s]*)/ig, "") + text = text.replace(/\@(?!yield)([^\n\s]*)/ig, "") text = beautifyHTML(text, options) # post script (Workaround) - text = text.replace(//ig, "@$1") + text = text.replace(//ig, "@$1") text = text.replace(/\(\ \'/ig, "('") @debug("Beautified HTML: #{text}") resolve text diff --git a/src/languages/html.coffee b/src/languages/html.coffee index 216cb36a8..dc047ed44 100644 --- a/src/languages/html.coffee +++ b/src/languages/html.coffee @@ -49,8 +49,8 @@ module.exports = { wrap_attributes: type: 'string' default: "auto" - enum: ["auto", "force", "force-aligned", "force-expand-multiline"] - description: "Wrap attributes to new lines [auto|force|force-aligned|force-expand-multiline]" + enum: ["auto", "aligned-multiple", "force", "force-aligned", "force-expand-multiline"] + description: "Wrap attributes to new lines [auto|aligned-multiple|force|force-aligned|force-expand-multiline]" wrap_attributes_indent_size: type: 'integer' default: null @@ -65,6 +65,12 @@ module.exports = { default: 10 description: "Number of line-breaks to be preserved in one chunk" unformatted: + type: 'array' + default: [] + items: + type: 'string' + description: "(Deprecated for most scenarios - consider inline or content_unformatted) List of tags that should not be reformatted at all. NOTE: Set this to [] to get improved beautifier behavior." + inline: type: 'array' default: [ 'a', 'abbr', 'area', 'audio', 'b', 'bdi', 'bdo', 'br', 'button', 'canvas', 'cite', @@ -73,13 +79,17 @@ module.exports = { 'object', 'output', 'progress', 'q', 'ruby', 's', 'samp', 'select', 'small', 'span', 'strong', 'sub', 'sup', 'svg', 'template', 'textarea', 'time', 'u', 'var', 'video', 'wbr', 'text', - 'acronym', 'address', 'big', 'dt', 'ins', 'small', 'strike', 'tt', - 'pre', - 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' + 'acronym', 'address', 'big', 'dt', 'ins', 'strike', 'tt' ] items: type: 'string' - description: "List of tags (defaults to inline) that should not be reformatted" + description: "List of inline tags. Behaves similar to text content, will not wrap without whitespace." + content_unformatted: + type: 'array' + default: [ 'pre', 'textarea' ] + items: + type: 'string' + description: "List of tags whose contents should not be reformatted. Attributes will be reformatted, inner html will not." end_with_newline: type: 'boolean' default: false diff --git a/src/options.json b/src/options.json index 60476a06c..5a302c170 100644 --- a/src/options.json +++ b/src/options.json @@ -302,11 +302,12 @@ "default": "auto", "enum": [ "auto", + "aligned-multiple", "force", "force-aligned", "force-expand-multiline" ], - "description": "Wrap attributes to new lines [auto|force|force-aligned|force-expand-multiline] (Supported by JS Beautify)", + "description": "Wrap attributes to new lines [auto|aligned-multiple|force|force-aligned|force-expand-multiline] (Supported by JS Beautify)", "title": "Wrap attributes", "beautifiers": [ "JS Beautify" @@ -361,6 +362,23 @@ } }, "unformatted": { + "type": "array", + "default": [], + "items": { + "type": "string" + }, + "description": "(Deprecated for most scenarios - consider inline or content_unformatted) List of tags that should not be reformatted at all. NOTE: Set this to [] to get improved beautifier behavior. (Supported by JS Beautify)", + "title": "Unformatted", + "beautifiers": [ + "JS Beautify" + ], + "key": "unformatted", + "language": { + "name": "HTML", + "namespace": "html" + } + }, + "inline": { "type": "array", "default": [ "a", @@ -421,26 +439,38 @@ "big", "dt", "ins", - "small", "strike", - "tt", + "tt" + ], + "items": { + "type": "string" + }, + "description": "List of inline tags. Behaves similar to text content, will not wrap without whitespace. (Supported by JS Beautify)", + "title": "Inline", + "beautifiers": [ + "JS Beautify" + ], + "key": "inline", + "language": { + "name": "HTML", + "namespace": "html" + } + }, + "content_unformatted": { + "type": "array", + "default": [ "pre", - "h1", - "h2", - "h3", - "h4", - "h5", - "h6" + "textarea" ], "items": { "type": "string" }, - "description": "List of tags (defaults to inline) that should not be reformatted (Supported by JS Beautify)", - "title": "Unformatted", + "description": "List of tags whose contents should not be reformatted. Attributes will be reformatted, inner html will not. (Supported by JS Beautify)", + "title": "Content unformatted", "beautifiers": [ "JS Beautify" ], - "key": "unformatted", + "key": "content_unformatted", "language": { "name": "HTML", "namespace": "html" @@ -1699,11 +1729,12 @@ "default": "auto", "enum": [ "auto", + "aligned-multiple", "force", "force-aligned", "force-expand-multiline" ], - "description": "Wrap attributes to new lines [auto|force|force-aligned|force-expand-multiline] (Supported by JS Beautify)", + "description": "Wrap attributes to new lines [auto|aligned-multiple|force|force-aligned|force-expand-multiline] (Supported by JS Beautify)", "title": "Wrap attributes", "beautifiers": [ "JS Beautify" @@ -1730,6 +1761,23 @@ } }, "unformatted": { + "type": "array", + "default": [], + "items": { + "type": "string" + }, + "description": "(Deprecated for most scenarios - consider inline or content_unformatted) List of tags that should not be reformatted at all. NOTE: Set this to [] to get improved beautifier behavior. (Supported by JS Beautify)", + "title": "Unformatted", + "beautifiers": [ + "JS Beautify" + ], + "key": "unformatted", + "language": { + "name": "HTML", + "namespace": "html" + } + }, + "inline": { "type": "array", "default": [ "a", @@ -1790,26 +1838,38 @@ "big", "dt", "ins", - "small", "strike", - "tt", + "tt" + ], + "items": { + "type": "string" + }, + "description": "List of inline tags. Behaves similar to text content, will not wrap without whitespace. (Supported by JS Beautify)", + "title": "Inline", + "beautifiers": [ + "JS Beautify" + ], + "key": "inline", + "language": { + "name": "HTML", + "namespace": "html" + } + }, + "content_unformatted": { + "type": "array", + "default": [ "pre", - "h1", - "h2", - "h3", - "h4", - "h5", - "h6" + "textarea" ], "items": { "type": "string" }, - "description": "List of tags (defaults to inline) that should not be reformatted (Supported by JS Beautify)", - "title": "Unformatted", + "description": "List of tags whose contents should not be reformatted. Attributes will be reformatted, inner html will not. (Supported by JS Beautify)", + "title": "Content unformatted", "beautifiers": [ "JS Beautify" ], - "key": "unformatted", + "key": "content_unformatted", "language": { "name": "HTML", "namespace": "html" @@ -2559,11 +2619,12 @@ "default": "auto", "enum": [ "auto", + "aligned-multiple", "force", "force-aligned", "force-expand-multiline" ], - "description": "Wrap attributes to new lines [auto|force|force-aligned|force-expand-multiline] (Supported by JS Beautify)", + "description": "Wrap attributes to new lines [auto|aligned-multiple|force|force-aligned|force-expand-multiline] (Supported by JS Beautify)", "title": "Wrap attributes", "beautifiers": [ "JS Beautify" @@ -2619,6 +2680,23 @@ } }, "unformatted": { + "type": "array", + "default": [], + "items": { + "type": "string" + }, + "description": "(Deprecated for most scenarios - consider inline or content_unformatted) List of tags that should not be reformatted at all. NOTE: Set this to [] to get improved beautifier behavior. (Supported by JS Beautify)", + "title": "Unformatted", + "beautifiers": [ + "JS Beautify" + ], + "key": "unformatted", + "language": { + "name": "HTML", + "namespace": "html" + } + }, + "inline": { "type": "array", "default": [ "a", @@ -2679,26 +2757,38 @@ "big", "dt", "ins", - "small", "strike", - "tt", + "tt" + ], + "items": { + "type": "string" + }, + "description": "List of inline tags. Behaves similar to text content, will not wrap without whitespace. (Supported by JS Beautify)", + "title": "Inline", + "beautifiers": [ + "JS Beautify" + ], + "key": "inline", + "language": { + "name": "HTML", + "namespace": "html" + } + }, + "content_unformatted": { + "type": "array", + "default": [ "pre", - "h1", - "h2", - "h3", - "h4", - "h5", - "h6" + "textarea" ], "items": { "type": "string" }, - "description": "List of tags (defaults to inline) that should not be reformatted (Supported by JS Beautify)", - "title": "Unformatted", + "description": "List of tags whose contents should not be reformatted. Attributes will be reformatted, inner html will not. (Supported by JS Beautify)", + "title": "Content unformatted", "beautifiers": [ "JS Beautify" ], - "key": "unformatted", + "key": "content_unformatted", "language": { "name": "HTML", "namespace": "html" @@ -2934,11 +3024,12 @@ "default": "auto", "enum": [ "auto", + "aligned-multiple", "force", "force-aligned", "force-expand-multiline" ], - "description": "Wrap attributes to new lines [auto|force|force-aligned|force-expand-multiline] (Supported by JS Beautify)", + "description": "Wrap attributes to new lines [auto|aligned-multiple|force|force-aligned|force-expand-multiline] (Supported by JS Beautify)", "title": "Wrap attributes", "beautifiers": [ "JS Beautify" @@ -2994,6 +3085,23 @@ } }, "unformatted": { + "type": "array", + "default": [], + "items": { + "type": "string" + }, + "description": "(Deprecated for most scenarios - consider inline or content_unformatted) List of tags that should not be reformatted at all. NOTE: Set this to [] to get improved beautifier behavior. (Supported by JS Beautify)", + "title": "Unformatted", + "beautifiers": [ + "JS Beautify" + ], + "key": "unformatted", + "language": { + "name": "HTML", + "namespace": "html" + } + }, + "inline": { "type": "array", "default": [ "a", @@ -3054,26 +3162,38 @@ "big", "dt", "ins", - "small", "strike", - "tt", + "tt" + ], + "items": { + "type": "string" + }, + "description": "List of inline tags. Behaves similar to text content, will not wrap without whitespace. (Supported by JS Beautify)", + "title": "Inline", + "beautifiers": [ + "JS Beautify" + ], + "key": "inline", + "language": { + "name": "HTML", + "namespace": "html" + } + }, + "content_unformatted": { + "type": "array", + "default": [ "pre", - "h1", - "h2", - "h3", - "h4", - "h5", - "h6" + "textarea" ], "items": { "type": "string" }, - "description": "List of tags (defaults to inline) that should not be reformatted (Supported by JS Beautify)", - "title": "Unformatted", + "description": "List of tags whose contents should not be reformatted. Attributes will be reformatted, inner html will not. (Supported by JS Beautify)", + "title": "Content unformatted", "beautifiers": [ "JS Beautify" ], - "key": "unformatted", + "key": "content_unformatted", "language": { "name": "HTML", "namespace": "html" @@ -5077,11 +5197,12 @@ "default": "auto", "enum": [ "auto", + "aligned-multiple", "force", "force-aligned", "force-expand-multiline" ], - "description": "Wrap attributes to new lines [auto|force|force-aligned|force-expand-multiline] (Supported by Marko Beautifier)", + "description": "Wrap attributes to new lines [auto|aligned-multiple|force|force-aligned|force-expand-multiline] (Supported by Marko Beautifier)", "title": "Wrap attributes", "beautifiers": [ "Marko Beautifier" @@ -5136,6 +5257,23 @@ } }, "unformatted": { + "type": "array", + "default": [], + "items": { + "type": "string" + }, + "description": "(Deprecated for most scenarios - consider inline or content_unformatted) List of tags that should not be reformatted at all. NOTE: Set this to [] to get improved beautifier behavior. (Supported by Marko Beautifier)", + "title": "Unformatted", + "beautifiers": [ + "Marko Beautifier" + ], + "key": "unformatted", + "language": { + "name": "HTML", + "namespace": "html" + } + }, + "inline": { "type": "array", "default": [ "a", @@ -5196,26 +5334,38 @@ "big", "dt", "ins", - "small", "strike", - "tt", + "tt" + ], + "items": { + "type": "string" + }, + "description": "List of inline tags. Behaves similar to text content, will not wrap without whitespace. (Supported by Marko Beautifier)", + "title": "Inline", + "beautifiers": [ + "Marko Beautifier" + ], + "key": "inline", + "language": { + "name": "HTML", + "namespace": "html" + } + }, + "content_unformatted": { + "type": "array", + "default": [ "pre", - "h1", - "h2", - "h3", - "h4", - "h5", - "h6" + "textarea" ], "items": { "type": "string" }, - "description": "List of tags (defaults to inline) that should not be reformatted (Supported by Marko Beautifier)", - "title": "Unformatted", + "description": "List of tags whose contents should not be reformatted. Attributes will be reformatted, inner html will not. (Supported by Marko Beautifier)", + "title": "Content unformatted", "beautifiers": [ "Marko Beautifier" ], - "key": "unformatted", + "key": "content_unformatted", "language": { "name": "HTML", "namespace": "html" @@ -5402,11 +5552,12 @@ "default": "auto", "enum": [ "auto", + "aligned-multiple", "force", "force-aligned", "force-expand-multiline" ], - "description": "Wrap attributes to new lines [auto|force|force-aligned|force-expand-multiline] (Supported by JS Beautify)", + "description": "Wrap attributes to new lines [auto|aligned-multiple|force|force-aligned|force-expand-multiline] (Supported by JS Beautify)", "title": "Wrap attributes", "beautifiers": [ "JS Beautify" @@ -5462,6 +5613,23 @@ } }, "unformatted": { + "type": "array", + "default": [], + "items": { + "type": "string" + }, + "description": "(Deprecated for most scenarios - consider inline or content_unformatted) List of tags that should not be reformatted at all. NOTE: Set this to [] to get improved beautifier behavior. (Supported by JS Beautify)", + "title": "Unformatted", + "beautifiers": [ + "JS Beautify" + ], + "key": "unformatted", + "language": { + "name": "HTML", + "namespace": "html" + } + }, + "inline": { "type": "array", "default": [ "a", @@ -5522,24 +5690,37 @@ "big", "dt", "strike", - "tt", + "tt" + ], + "items": { + "type": "string" + }, + "description": "List of inline tags. Behaves similar to text content, will not wrap without whitespace. (Supported by JS Beautify)", + "title": "Inline", + "beautifiers": [ + "JS Beautify" + ], + "key": "inline", + "language": { + "name": "HTML", + "namespace": "html" + } + }, + "content_unformatted": { + "type": "array", + "default": [ "pre", - "h1", - "h2", - "h3", - "h4", - "h5", - "h6" + "textarea" ], "items": { "type": "string" }, - "description": "List of tags (defaults to inline) that should not be reformatted (Supported by JS Beautify)", - "title": "Unformatted", + "description": "List of tags whose contents should not be reformatted. Attributes will be reformatted, inner html will not. (Supported by JS Beautify)", + "title": "Content unformatted", "beautifiers": [ "JS Beautify" ], - "key": "unformatted", + "key": "content_unformatted", "language": { "name": "HTML", "namespace": "html" @@ -8435,11 +8616,12 @@ "default": "auto", "enum": [ "auto", + "aligned-multiple", "force", "force-aligned", "force-expand-multiline" ], - "description": "Wrap attributes to new lines [auto|force|force-aligned|force-expand-multiline] (Supported by Vue Beautifier)", + "description": "Wrap attributes to new lines [auto|aligned-multiple|force|force-aligned|force-expand-multiline] (Supported by Vue Beautifier)", "title": "Wrap attributes", "beautifiers": [ "Vue Beautifier" @@ -8466,6 +8648,23 @@ } }, "unformatted": { + "type": "array", + "default": [], + "items": { + "type": "string" + }, + "description": "(Deprecated for most scenarios - consider inline or content_unformatted) List of tags that should not be reformatted at all. NOTE: Set this to [] to get improved beautifier behavior. (Supported by Vue Beautifier)", + "title": "Unformatted", + "beautifiers": [ + "Vue Beautifier" + ], + "key": "unformatted", + "language": { + "name": "HTML", + "namespace": "html" + } + }, + "inline": { "type": "array", "default": [ "a", @@ -8526,26 +8725,38 @@ "big", "dt", "ins", - "small", "strike", - "tt", + "tt" + ], + "items": { + "type": "string" + }, + "description": "List of inline tags. Behaves similar to text content, will not wrap without whitespace. (Supported by Vue Beautifier)", + "title": "Inline", + "beautifiers": [ + "Vue Beautifier" + ], + "key": "inline", + "language": { + "name": "HTML", + "namespace": "html" + } + }, + "content_unformatted": { + "type": "array", + "default": [ "pre", - "h1", - "h2", - "h3", - "h4", - "h5", - "h6" + "textarea" ], "items": { "type": "string" }, - "description": "List of tags (defaults to inline) that should not be reformatted (Supported by Vue Beautifier)", - "title": "Unformatted", + "description": "List of tags whose contents should not be reformatted. Attributes will be reformatted, inner html will not. (Supported by Vue Beautifier)", + "title": "Content unformatted", "beautifiers": [ "Vue Beautifier" ], - "key": "unformatted", + "key": "content_unformatted", "language": { "name": "HTML", "namespace": "html" @@ -8889,11 +9100,12 @@ "default": "auto", "enum": [ "auto", + "aligned-multiple", "force", "force-aligned", "force-expand-multiline" ], - "description": "Wrap attributes to new lines [auto|force|force-aligned|force-expand-multiline] (Supported by JS Beautify)", + "description": "Wrap attributes to new lines [auto|aligned-multiple|force|force-aligned|force-expand-multiline] (Supported by JS Beautify)", "title": "Wrap attributes", "beautifiers": [ "JS Beautify" @@ -8949,6 +9161,23 @@ } }, "unformatted": { + "type": "array", + "default": [], + "items": { + "type": "string" + }, + "description": "(Deprecated for most scenarios - consider inline or content_unformatted) List of tags that should not be reformatted at all. NOTE: Set this to [] to get improved beautifier behavior. (Supported by JS Beautify)", + "title": "Unformatted", + "beautifiers": [ + "JS Beautify" + ], + "key": "unformatted", + "language": { + "name": "HTML", + "namespace": "html" + } + }, + "inline": { "type": "array", "default": [ "a", @@ -9009,26 +9238,38 @@ "big", "dt", "ins", - "small", "strike", - "tt", + "tt" + ], + "items": { + "type": "string" + }, + "description": "List of inline tags. Behaves similar to text content, will not wrap without whitespace. (Supported by JS Beautify)", + "title": "Inline", + "beautifiers": [ + "JS Beautify" + ], + "key": "inline", + "language": { + "name": "HTML", + "namespace": "html" + } + }, + "content_unformatted": { + "type": "array", + "default": [ "pre", - "h1", - "h2", - "h3", - "h4", - "h5", - "h6" + "textarea" ], "items": { "type": "string" }, - "description": "List of tags (defaults to inline) that should not be reformatted (Supported by JS Beautify)", - "title": "Unformatted", + "description": "List of tags whose contents should not be reformatted. Attributes will be reformatted, inner html will not. (Supported by JS Beautify)", + "title": "Content unformatted", "beautifiers": [ "JS Beautify" ], - "key": "unformatted", + "key": "content_unformatted", "language": { "name": "HTML", "namespace": "html"