js-beautify 1.9.1 → 1.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +47 -1
- package/README.md +20 -17
- package/js/lib/beautifier.js +192 -69
- package/js/lib/beautifier.min.js +1 -1
- package/js/lib/beautify-css.js +45 -22
- package/js/lib/beautify-html.js +123 -31
- package/js/lib/beautify.js +46 -16
- package/js/lib/cli.js +3 -0
- package/js/src/cli.js +3 -0
- package/js/src/core/options.js +5 -0
- package/js/src/core/templatablepattern.js +12 -0
- package/js/src/css/beautifier.js +40 -22
- package/js/src/html/beautifier.js +61 -17
- package/js/src/html/options.js +4 -0
- package/js/src/html/tokenizer.js +41 -14
- package/js/src/javascript/beautifier.js +26 -11
- package/js/src/javascript/tokenizer.js +3 -5
- package/package.json +9 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,50 @@
|
|
|
1
1
|
# Changelog
|
|
2
|
+
## v1.10.2
|
|
3
|
+
|
|
4
|
+
### Description
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
### Closed Issues
|
|
8
|
+
* Please update CodeMirror Addon ([#1695](https://github.com/beautify-web/js-beautify/issues/1695))
|
|
9
|
+
* Nested braces indentation ([#223](https://github.com/beautify-web/js-beautify/issues/223))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## v1.10.1
|
|
13
|
+
|
|
14
|
+
### Description
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Closed Issues
|
|
18
|
+
* javascript fails to format when <?php > is first text inside <script> tag ([#1687](https://github.com/beautify-web/js-beautify/issues/1687))
|
|
19
|
+
* 414 Request-URI Too Large ([#1640](https://github.com/beautify-web/js-beautify/issues/1640))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## v1.10.0
|
|
23
|
+
|
|
24
|
+
### Description
|
|
25
|
+
# Description
|
|
26
|
+
* Added `templating` setting to control when template languages are recognized. All languages are off by default in Javascript and on by default in HTML.
|
|
27
|
+
* Thanks to @HanabishiRecca, @averydev, @kalbasit, @asteinha for contributions
|
|
28
|
+
|
|
29
|
+
https://github.com/beautify-web/js-beautify/compare/v1.9.1...v1.10.0
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### Closed Issues
|
|
34
|
+
* beautifying scss selector with colon in it adds space ([#1667](https://github.com/beautify-web/js-beautify/issues/1667))
|
|
35
|
+
* Javascript multiline comments duplicates ([#1663](https://github.com/beautify-web/js-beautify/issues/1663))
|
|
36
|
+
* Tokenizer crashes if the input terminates with a dot character. ([#1658](https://github.com/beautify-web/js-beautify/issues/1658))
|
|
37
|
+
* stop reformatting valid css \\! into invalid \\ ! ([#1656](https://github.com/beautify-web/js-beautify/pull/1656))
|
|
38
|
+
* wrong indent for unclosed <? - need to support disabling templating ([#1647](https://github.com/beautify-web/js-beautify/issues/1647))
|
|
39
|
+
* Beautify inserts space before exclamation mark in comment <!-- in css <style> ([#1641](https://github.com/beautify-web/js-beautify/issues/1641))
|
|
40
|
+
* 'less' mixins parameter formatting problem ([#1582](https://github.com/beautify-web/js-beautify/issues/1582))
|
|
41
|
+
* Change css tests to use 4 space indenting instead of tabs ([#1527](https://github.com/beautify-web/js-beautify/issues/1527))
|
|
42
|
+
* Braces after case get pushed onto new line ([#1357](https://github.com/beautify-web/js-beautify/issues/1357))
|
|
43
|
+
* Extra space in pseudo-elements and pseudo-classes selectors ([#1233](https://github.com/beautify-web/js-beautify/issues/1233))
|
|
44
|
+
* LESS formatting - mixins with multiple variables ([#1018](https://github.com/beautify-web/js-beautify/issues/1018))
|
|
45
|
+
* Bug in less format ([#842](https://github.com/beautify-web/js-beautify/issues/842))
|
|
46
|
+
|
|
47
|
+
|
|
2
48
|
## v1.9.1
|
|
3
49
|
|
|
4
50
|
### Description
|
|
@@ -453,7 +499,7 @@ Added `content_unformatted` option (Thanks @arai-a)
|
|
|
453
499
|
* Add handlebars support on cli for html ([#935](https://github.com/beautify-web/js-beautify/pull/935))
|
|
454
500
|
* Do not put a space within `yield*` generator functions. ([#920](https://github.com/beautify-web/js-beautify/issues/920))
|
|
455
501
|
* Possible to add an indent_inner_inner_html option? (Prevent indenting second-level tags) ([#917](https://github.com/beautify-web/js-beautify/issues/917))
|
|
456
|
-
* Messing up jsx formatting ([#914](https://github.com/beautify-web/js-beautify/issues/914))
|
|
502
|
+
* Messing up jsx formatting multi-line attribute ([#914](https://github.com/beautify-web/js-beautify/issues/914))
|
|
457
503
|
* Bug report: Closing 'body' tag isn't formatted correctly ([#900](https://github.com/beautify-web/js-beautify/issues/900))
|
|
458
504
|
* { throw … } not working with collapse-preserve-inline ([#898](https://github.com/beautify-web/js-beautify/issues/898))
|
|
459
505
|
* ES6 concise method not propely indented ([#889](https://github.com/beautify-web/js-beautify/issues/889))
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
[](https://gitter.im/beautify-web/js-beautify?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
|
10
10
|
[](https://twitter.com/intent/user?screen_name=js_beautifier)
|
|
11
11
|
|
|
12
|
-
[](https://www.npmjs.org/package/js-beautify)
|
|
12
|
+
[](https://www.npmjs.org/package/js-beautify) [](https://greenkeeper.io/)
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
This little beautifier will reformat and re-indent bookmarklets, ugly
|
|
@@ -61,17 +61,17 @@ JS Beautifier is hosted on two CDN services: [cdnjs](https://cdnjs.com/libraries
|
|
|
61
61
|
|
|
62
62
|
To pull the latest version from one of these services include one set of the script tags below in your document:
|
|
63
63
|
```html
|
|
64
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.
|
|
65
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.
|
|
66
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.
|
|
64
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.10.2/beautify.js"></script>
|
|
65
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.10.2/beautify-css.js"></script>
|
|
66
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.10.2/beautify-html.js"></script>
|
|
67
67
|
|
|
68
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.
|
|
69
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.
|
|
70
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.
|
|
68
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.10.2/beautify.min.js"></script>
|
|
69
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.10.2/beautify-css.min.js"></script>
|
|
70
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.10.2/beautify-html.min.js"></script>
|
|
71
71
|
|
|
72
|
-
<script src="https://cdn.rawgit.com/beautify-web/js-beautify/v1.
|
|
73
|
-
<script src="https://cdn.rawgit.com/beautify-web/js-beautify/v1.
|
|
74
|
-
<script src="https://cdn.rawgit.com/beautify-web/js-beautify/v1.
|
|
72
|
+
<script src="https://cdn.rawgit.com/beautify-web/js-beautify/v1.10.2/js/lib/beautify.js"></script>
|
|
73
|
+
<script src="https://cdn.rawgit.com/beautify-web/js-beautify/v1.10.2/js/lib/beautify-css.js"></script>
|
|
74
|
+
<script src="https://cdn.rawgit.com/beautify-web/js-beautify/v1.10.2/js/lib/beautify-html.js"></script>
|
|
75
75
|
```
|
|
76
76
|
|
|
77
77
|
Older versions are available by changing the version number.
|
|
@@ -93,7 +93,7 @@ You can beautify javascript using JS Beautifier in your web browser, or on the c
|
|
|
93
93
|
## Web Browser
|
|
94
94
|
Open [beautifier.io](https://beautifier.io/). Options are available via the UI.
|
|
95
95
|
|
|
96
|
-
## Web
|
|
96
|
+
## Web Library
|
|
97
97
|
The script tags above expose three functions: `js_beautify`, `css_beautify`, and `html_beautify`.
|
|
98
98
|
|
|
99
99
|
## Node.js JavaScript
|
|
@@ -191,6 +191,7 @@ Beautifier Options:
|
|
|
191
191
|
-C, --comma-first Put commas at the beginning of new line instead of end
|
|
192
192
|
-O, --operator-position Set operator position (before-newline|after-newline|preserve-newline) [before-newline]
|
|
193
193
|
--indent-empty-lines Keep indentation on empty lines
|
|
194
|
+
--templating List of templating languages (auto,django,erb,handlebars,php) ["auto"] auto = none in JavaScript, all in html
|
|
194
195
|
```
|
|
195
196
|
|
|
196
197
|
Which correspond to the underscored option keys for both library interfaces
|
|
@@ -221,7 +222,8 @@ Which correspond to the underscored option keys for both library interfaces
|
|
|
221
222
|
"e4x": false,
|
|
222
223
|
"comma_first": false,
|
|
223
224
|
"operator_position": "before-newline",
|
|
224
|
-
"indent_empty_lines": false
|
|
225
|
+
"indent_empty_lines": false,
|
|
226
|
+
"templating": ["auto"]
|
|
225
227
|
}
|
|
226
228
|
```
|
|
227
229
|
|
|
@@ -342,15 +344,16 @@ HTML Beautifier Options:
|
|
|
342
344
|
--indent_scripts Sets indent level inside script tags ("normal", "keep", "separate")
|
|
343
345
|
--unformatted_content_delimiter Keep text content together between this string [""]
|
|
344
346
|
--indent-empty-lines Keep indentation on empty lines
|
|
347
|
+
--templating List of templating languages (auto,none,django,erb,handlebars,php) ["auto"] auto = none in JavaScript, all in html
|
|
345
348
|
```
|
|
346
349
|
|
|
347
350
|
## Directives
|
|
348
351
|
|
|
349
|
-
Directives let you control the behavior of the Beautifier from within your source files. Directives are placed in comments inside the file. Directives are in the format `/* beautify {name}:{value} */` in CSS and JavaScript. In HTML they are formatted as `<!-- beautify {name}:{value} -->`.
|
|
352
|
+
Directives let you control the behavior of the Beautifier from within your source files. Directives are placed in comments inside the file. Directives are in the format `/* beautify {name}:{value} */` in CSS and JavaScript. In HTML they are formatted as `<!-- beautify {name}:{value} -->`.
|
|
350
353
|
|
|
351
354
|
### Ignore directive
|
|
352
355
|
|
|
353
|
-
The `ignore` directive makes the beautifier completely ignore part of a file, treating it as literal text that is not parsed.
|
|
356
|
+
The `ignore` directive makes the beautifier completely ignore part of a file, treating it as literal text that is not parsed.
|
|
354
357
|
The input below will remain unchanged after beautification:
|
|
355
358
|
|
|
356
359
|
```js
|
|
@@ -361,9 +364,9 @@ var a = 1;
|
|
|
361
364
|
/* beautify ignore:end */
|
|
362
365
|
```
|
|
363
366
|
|
|
364
|
-
### Preserve directive
|
|
367
|
+
### Preserve directive
|
|
365
368
|
|
|
366
|
-
NOTE: this directive only works in HTML and JavaScript, not CSS.
|
|
369
|
+
NOTE: this directive only works in HTML and JavaScript, not CSS.
|
|
367
370
|
|
|
368
371
|
The `preserve` directive makes the Beautifier parse and then keep the existing formatting of a section of code.
|
|
369
372
|
|
|
@@ -396,4 +399,4 @@ Thanks also to Jason Diamond, Patrick Hof, Nochum Sossonko, Andreas Schneider, D
|
|
|
396
399
|
Vasilevsky, Vital Batmanov, Ron Baldwin, Gabriel Harrison, Chris J. Shull,
|
|
397
400
|
Mathias Bynens, Vittorio Gambaletta and others.
|
|
398
401
|
|
|
399
|
-
(README.md: js-beautify@1.
|
|
402
|
+
(README.md: js-beautify@1.10.2)
|