Skip to content

Commit 11e21b0

Browse files
authored
Merge pull request #2167 from beautify-web/staging/release
Pulling staging/release into release
2 parents f2a11a3 + 3936d74 commit 11e21b0

File tree

21 files changed

+148
-55
lines changed

21 files changed

+148
-55
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## v1.14.9
4+
* Bump semver and editorconfig ([#2161](https://github.com/beautify-web/js-beautify/pull/2161))
5+
* Update editorconfig package ([#2160](https://github.com/beautify-web/js-beautify/issues/2160))
6+
* Allow to configure the "custom elements as inline elements" behavior ([#2113](https://github.com/beautify-web/js-beautify/issues/2113))
7+
38
## v1.14.8
49
* Require nodejs v12 or greater ([#2151](https://github.com/beautify-web/js-beautify/pull/2151))
510
* CSS insideNonNestedAtRule generic variable ([#2147](https://github.com/beautify-web/js-beautify/pull/2147))

README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ JS Beautifier is hosted on two CDN services: [cdnjs](https://cdnjs.com/libraries
5858

5959
To pull the latest version from one of these services include one set of the script tags below in your document:
6060
```html
61-
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.8/beautify.js"></script>
62-
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.8/beautify-css.js"></script>
63-
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.8/beautify-html.js"></script>
61+
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.9/beautify.js"></script>
62+
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.9/beautify-css.js"></script>
63+
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.9/beautify-html.js"></script>
6464

65-
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.8/beautify.min.js"></script>
66-
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.8/beautify-css.min.js"></script>
67-
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.8/beautify-html.min.js"></script>
65+
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.9/beautify.min.js"></script>
66+
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.9/beautify-css.min.js"></script>
67+
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.9/beautify-html.min.js"></script>
6868
```
6969

7070
Example usage of a JS tag in html:
@@ -76,7 +76,7 @@ Example usage of a JS tag in html:
7676

7777
. . .
7878

79-
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.8/beautify.min.js"></script>
79+
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.9/beautify.min.js"></script>
8080
<script src="script.js"></script>
8181
</body>
8282
</html>
@@ -371,6 +371,7 @@ HTML Beautifier Options:
371371
-M, --wrap-attributes-min-attrs Minimum number of html tag attributes for force wrap attribute options [2]
372372
-i, --wrap-attributes-indent-size Indent wrapped attributes to after N characters [indent-size] (ignored if wrap-attributes is "aligned")
373373
-d, --inline List of tags to be considered inline tags
374+
--inline_custom_elements Inline custom elements [true]
374375
-U, --unformatted List of tags (defaults to inline) that should not be reformatted
375376
-T, --content_unformatted List of tags (defaults to pre) whose content should not be reformatted
376377
-E, --extra_liners List of tags (defaults to [head,body,/html] that should have an extra newline before them.
@@ -433,4 +434,4 @@ Thanks also to Jason Diamond, Patrick Hof, Nochum Sossonko, Andreas Schneider, D
433434
Vasilevsky, Vital Batmanov, Ron Baldwin, Gabriel Harrison, Chris J. Shull,
434435
Mathias Bynens, Vittorio Gambaletta and others.
435436
436-
(README.md: js-beautify@1.14.8)
437+
(README.md: js-beautify@1.14.9)

js/lib/beautifier.js

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/lib/beautifier.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/lib/beautifier.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/lib/beautifier.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/lib/beautify-html.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2404,7 +2404,7 @@ Beautifier.prototype._get_tag_open_token = function(raw_token) { //function to g
24042404

24052405
parser_token.is_unformatted = !parser_token.tag_complete && in_array(parser_token.tag_check, this._options.unformatted);
24062406
parser_token.is_content_unformatted = !parser_token.is_empty_element && in_array(parser_token.tag_check, this._options.content_unformatted);
2407-
parser_token.is_inline_element = in_array(parser_token.tag_name, this._options.inline) || parser_token.tag_name.includes("-") || parser_token.tag_start_char === '{';
2407+
parser_token.is_inline_element = in_array(parser_token.tag_name, this._options.inline) || (this._options.inline_custom_elements && parser_token.tag_name.includes("-")) || parser_token.tag_start_char === '{';
24082408

24092409
return parser_token;
24102410
};
@@ -2691,6 +2691,7 @@ function Options(options) {
26912691
// obsolete inline tags
26922692
'acronym', 'big', 'strike', 'tt'
26932693
]);
2694+
this.inline_custom_elements = this._get_boolean('inline_custom_elements', true);
26942695
this.void_elements = this._get_array('void_elements', [
26952696
// HTLM void elements - aka self-closing tags - aka singletons
26962697
// https://www.w3.org/html/wg/drafts/html/master/syntax.html#void-elements

js/lib/cli.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ var path = require('path'),
116116
// HTML-only
117117
"max_char": Number, // obsolete since 1.3.5
118118
"inline": [String, Array],
119+
"inline_custom_elements": [Boolean],
119120
"unformatted": [String, Array],
120121
"content_unformatted": [String, Array],
121122
"indent_inner_html": [Boolean],
@@ -168,6 +169,7 @@ var path = require('path'),
168169
"i": ["--wrap_attributes_indent_size"],
169170
"W": ["--max_char"], // obsolete since 1.3.5
170171
"d": ["--inline"],
172+
// no shorthand for "inline_custom_elements"
171173
"U": ["--unformatted"],
172174
"T": ["--content_unformatted"],
173175
"I": ["--indent_inner_html"],

js/src/cli.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ var path = require('path'),
116116
// HTML-only
117117
"max_char": Number, // obsolete since 1.3.5
118118
"inline": [String, Array],
119+
"inline_custom_elements": [Boolean],
119120
"unformatted": [String, Array],
120121
"content_unformatted": [String, Array],
121122
"indent_inner_html": [Boolean],
@@ -168,6 +169,7 @@ var path = require('path'),
168169
"i": ["--wrap_attributes_indent_size"],
169170
"W": ["--max_char"], // obsolete since 1.3.5
170171
"d": ["--inline"],
172+
// no shorthand for "inline_custom_elements"
171173
"U": ["--unformatted"],
172174
"T": ["--content_unformatted"],
173175
"I": ["--indent_inner_html"],

js/src/html/beautifier.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ Beautifier.prototype._get_tag_open_token = function(raw_token) { //function to g
656656

657657
parser_token.is_unformatted = !parser_token.tag_complete && in_array(parser_token.tag_check, this._options.unformatted);
658658
parser_token.is_content_unformatted = !parser_token.is_empty_element && in_array(parser_token.tag_check, this._options.content_unformatted);
659-
parser_token.is_inline_element = in_array(parser_token.tag_name, this._options.inline) || parser_token.tag_name.includes("-") || parser_token.tag_start_char === '{';
659+
parser_token.is_inline_element = in_array(parser_token.tag_name, this._options.inline) || (this._options.inline_custom_elements && parser_token.tag_name.includes("-")) || parser_token.tag_start_char === '{';
660660

661661
return parser_token;
662662
};

0 commit comments

Comments
 (0)