diff --git a/README.md b/README.md index cce4693e..6d8d5c7b 100644 --- a/README.md +++ b/README.md @@ -169,7 +169,7 @@ HTML Beautifier Options: -m, --max-preserve-newlines Maximum number of line-breaks to be preserved in one chunk [10] -U, --unformatted List of tags (defaults to inline) that should not be reformatted -n, --end_with_newline End output with newline - -E, --extra_liners List of tags (defaults to inline) that should be followed by an extra newline + -E, --extra_liners List of tags (defaults to [head,body,/html] that should have an extra newline before them. ``` # License diff --git a/js/lib/beautify-html.js b/js/lib/beautify-html.js index 70b711d0..c7a71604 100644 --- a/js/lib/beautify-html.js +++ b/js/lib/beautify-html.js @@ -53,7 +53,7 @@ max_preserve_newlines (default unlimited) - maximum number of line breaks to be preserved in one chunk indent_handlebars (default false) - format and indent {{#foo}} and {{/foo}} end_with_newline (false) - end with a newline - extra_liners (default ['html', 'head', '/html']) - add an extra newline after these tags + extra_liners (default [head,body,/html]) -List of tags that should have an extra newline before them. e.g. @@ -121,7 +121,9 @@ : 0; indent_handlebars = (options.indent_handlebars === undefined) ? false : options.indent_handlebars; end_with_newline = (options.end_with_newline === undefined) ? false : options.end_with_newline; - extra_liners = Array.isArray(options.extra_liners) ? options.extra_liners : 'head,body,/html'.split(','); + extra_liners = Array.isArray(options.extra_liners) ? + options.extra_liners : (typeof options.extra_liners === 'string') ? + options.extra_liners.split(',') : 'head,body,/html'.split(','); function Parser() { this.pos = 0; //Parser position diff --git a/js/lib/cli.js b/js/lib/cli.js index 9f6a9fdf..020a65d6 100755 --- a/js/lib/cli.js +++ b/js/lib/cli.js @@ -242,7 +242,7 @@ function usage(err) { msg.push(' -p, --preserve-newlines Preserve line-breaks (--no-preserve-newlines disables)'); msg.push(' -m, --max-preserve-newlines Number of line-breaks to be preserved in one chunk [10]'); msg.push(' -U, --unformatted List of tags (defaults to inline) that should not be reformatted'); - msg.push(' -E, --extra_liners List of tags (defaults to inline) that should be followed by an extra newline'); + msg.push(' -E, --extra_liners List of tags (defaults to [head,body,/html] that should have an extra newline'); break; case "css": msg.push(' -L, --selector-separator-newline Add a newline between multiple selectors.')