forked from prettydiff/prettydiff
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocumentation.xhtml
491 lines (491 loc) · 74.2 KB
/
documentation.xhtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Pretty Diff - Documentation</title>
<link
href="https://prettydiff.com/documentation.xhtml"
rel="canonical"
type="application/xhtml+xml"/>
<link
href="https://prettydiff.com/labels.rdf"
rel="meta"
title="ICRA labels"
type="application/rdf+xml"/>
<link href="css/index.css?1567466257926" media="all" rel="stylesheet" type="text/css"/>
<link rel="apple-touch-icon" sizes="57x57" href="favicon/apple-icon-57x57.png"/>
<link rel="apple-touch-icon" sizes="60x60" href="favicon/apple-icon-60x60.png"/>
<link rel="apple-touch-icon" sizes="72x72" href="favicon/apple-icon-72x72.png"/>
<link rel="apple-touch-icon" sizes="76x76" href="favicon/apple-icon-76x76.png"/>
<link rel="apple-touch-icon" sizes="114x114" href="favicon/apple-icon-114x114.png"/>
<link rel="apple-touch-icon" sizes="120x120" href="favicon/apple-icon-120x120.png"/>
<link rel="apple-touch-icon" sizes="144x144" href="favicon/apple-icon-144x144.png"/>
<link rel="apple-touch-icon" sizes="152x152" href="favicon/apple-icon-152x152.png"/>
<link rel="apple-touch-icon" sizes="180x180" href="favicon/apple-icon-180x180.png"/>
<link rel="icon" type="image/png" sizes="192x192" href="favicon/android-icon-192x192.png"/>
<link rel="icon" type="image/png" sizes="32x32" href="favicon/favicon-32x32.png"/>
<link rel="icon" type="image/png" sizes="96x96" href="favicon/favicon-96x96.png"/>
<link rel="icon" type="image/png" sizes="16x16" href="favicon/favicon-16x16.png"/>
<link rel="manifest" href="favicon/manifest.json"/>
<meta name="msapplication-TileColor" content="#ffffff"/>
<meta name="msapplication-TileImage" content="favicon/ms-icon-144x144.png"/>
<meta name="theme-color" content="#ffffff"/>
<link href="favicon/favicon.ico" rel="icon" type="image/x-icon"/>
<meta content="width=device-width, initial-scale=1" name="viewport"/>
<meta content="index, follow" name="robots"/>
<meta content="Pretty Diff - The difference tool" name="DC.title"/>
<meta
content="(pics-1.1 'http://www.icra.org/pics/vocabularyv03/' l gen true for 'https://prettydiff.com' r (n 0 s 0 v 0 l 0 oa 0 ob 0 oc 0 od 0 oe 0 of 0 og 0 oh 0 c 1) gen true for 'http://www.prettydiff.com' r (n 0 s 0 v 0 l 0 oa 0 ob 0 oc 0 od 0 oe 0 of 0 og 0 oh 0 c 1))"
http-equiv="pics-Label"/>
<meta content="Austin Cheney" name="author"/>
<meta
content="Pretty Diff tool can minify, beautify (pretty-print), or diff between minified and beautified code. This tool can even beautify and minify HTML."
name="description"/>
<meta content="Global" name="distribution"/>
<meta content="en" http-equiv="Content-Language"/>
<meta content="application/xhtml+xml;charset=UTF-8" http-equiv="Content-Type"/>
<meta content="blendTrans(Duration=0)" http-equiv="Page-Enter"/>
<meta content="blendTrans(Duration=0)" http-equiv="Page-Exit"/>
<meta content="text/css" http-equiv="content-style-type"/>
<meta content="application/javascript" http-equiv="content-script-type"/>
<meta
content="qL8AV9yjL2-ZFGV9ey6wU3t7pTZdpD4lIetUSiNen7E"
name="google-site-verification"/>
</head>
<body class="white" id="prettydiff">
<div class="contentarea" id="documentation">
<section role="heading">
<h1>
<svg
height="2000.000000pt"
id="pdlogo"
preserveAspectRatio="xMidYMid meet"
version="1.0"
viewBox="0 0 2000.000000 2000.000000"
width="2000.000000pt"
xmlns="http://www.w3.org/2000/svg">
<g
fill="#999"
stroke="none"
transform="translate(0.000000,2000.000000) scale(0.100000,-0.100000)">
<path
d="M14871 18523 c-16 -64 -611 -2317 -946 -3588 -175 -660 -319 -1202 -320 -1204 -2 -2 -50 39 -107 91 -961 876 -2202 1358 -3498 1358 -1255 0 -2456 -451 -3409 -1279 -161 -140 -424 -408 -560 -571 -507 -607 -870 -1320 -1062 -2090 -58 -232 -386 -1479 -2309 -8759 -148 -563 -270 -1028 -270 -1033 0 -4 614 -8 1365 -8 l1364 0 10 38 c16 63 611 2316 946 3587 175 660 319 1202 320 1204 2 2 50 -39 107 -91 543 -495 1169 -862 1863 -1093 1707 -568 3581 -211 4965 946 252 210 554 524 767 796 111 143 312 445 408 613 229 406 408 854 525 1320 57 225 380 1451 2310 8759 148 563 270 1028 270 1033 0 4 -614 8 -1365 8 l-1364 0 -10 -37z m-4498 -5957 c477 -77 889 -256 1245 -542 523 -419 850 -998 954 -1689 18 -121 18 -549 0 -670 -80 -529 -279 -972 -612 -1359 -412 -480 -967 -779 -1625 -878 -121 -18 -549 -18 -670 0 -494 74 -918 255 -1283 548 -523 419 -850 998 -954 1689 -18 121 -18 549 0 670 104 691 431 1270 954 1689 365 293 828 490 1283 545 50 6 104 13 120 15 72 10 495 -3 588 -18z"/></g>
</svg>
<a href="/">Pretty Diff</a>
- Documentation</h1>
<p class="doc-version"><span>Version - <strong>101.2.6</strong></span> <span><a href="https://sparser.io">Sparser</a> - <strong>1.2.0</strong></span></p>
<p id="dcolorScheme">
<label class="label" for="option-color">Color Scheme</label>
<select id="option-color">
<option>Canvas</option>
<option>Shadow</option>
<option selected="selected">White</option>
</select>
</p>
<p>Browse Pretty Diff on
<a href="https://github.com/prettydiff/prettydiff">GitHub</a> or <a href="https://www.npmjs.com/package/prettydiff">NPM</a>.</p>
</section>
<section id="doc-content" role="main">
<div>
<h2>
<button aria-disabled="true" class="heading" role="presentation">About Pretty Diff
<span aria-hidden="true">Show</span>
</button>
</h2>
<div class="content-hide">
<div class="segment" id="purpose">
<h3>Purpose</h3>
<p>Pretty Diff is a language aware code comparison tool, beautifier, minifier,
and parser for a variety of languages.</p>
<p>Pretty Diff was created to compare code samples for various languages regardless of differences in comments, white space, and other factors. Currently, the
project operates by beautifying code and then comparing the beautified
product of the code samples. The goal in a
<a href="https://github.com/prettydiff/prettydiff/issues/71">future version</a>
is to introduce the comparison step directly into the beautifiers between the
parse step and the beautification step to become a truely language aware code
comparison and analysis tool.</p>
</div>
<div class="segment" id="goals">
<h3>Goals</h3>
<dl>
<dt>portability</dt>
<dd>The project should be immediately available cross platform, across various
interfaces, and without a build process. All documentation and required
supporting artifacts are included with the project code.</dd>
<dt>productivity</dt>
<dd>The project should save a developer substantial time by making code easier to
read against a variety of settings and reduce the steps to complete
a given code analysis task.</dd>
<dt>reproducibility</dt>
<dd>Code pushed through the project in any one mode should be equally restorable
to its previous state using a different mode.</dd>
<dt>simplicity</dt>
<dd>The project should do more with less code. The intended audience of this
project are software developers, who may need to modify the project code to fit
custom needs. Less code means increased portability. Clearer simple code allows separation of
concerns, and cleaner organization.</dd>
</dl>
</div>
<div class="segment" id="modes">
<h3>Supported Operations (modes)</h3>
<p>Pretty Diff currently supports these four operations:</p>
<dl>
<dt>diff</dt>
<dd>The code comparison mode. This is the default mode and the only mode to
require two code samples.</dd>
<dt>beautify</dt>
<dd>Pretty Diff has progressively moved from community driven dependencies to
custom parsers to accomplish code beautification for a diversity of features and
requests.</dd>
<dt>minify</dt>
<dd>Each of Pretty Diff's beautification libraries has a minify feature. The
goal is to reduce code size but only to such an extent that the code can be
restored to its prior state through beautification, excluding code comments.</dd>
<dt>parse</dt>
<dd>Most code parsers generate a final product called an Abstract Syntax Tree
(AST). Pretty Diff, instead, leans on the <a href="http://github.com/unibeautify/sparser">sparser</a> project which produces parse output as a data table.</dd>
<!--dt>analysis</dt>
<dd>HTML formatted reports evaluating the code. The reports differ in content
and structure by the parser(s) used.</dd-->
</dl>
</div>
<div class="segment" id="languages">
<h3>Supported Languages</h3>
<!-- documentation languages start --><ul><li>markup <ul><li><a href="https://velocity.apache.org/">Apache Velocity</a>
</li><li><a href="https://support.microsoft.com/en-us/help/976112/introduction-to-asp-net-inline-expressions-in-the-net-framework">ASP Inline Expression</a>
</li><li><a href="https://www.adobe.com/products/coldfusion-family.html">CFML (ColdFusion Markup Language)</a>
</li><li><a href="https://docs.djangoproject.com/en/2.1/topics/forms/">Django Inline HTML</a>
</li><li><a href="https://www.dustjs.com/">Dust.js</a>
</li><li><a href="https://hexdocs.pm/eex/EEx.html">EEX Elixir Templates</a>
</li><li><a href="https://www.ejs.co/">EJS (Embedded JavaScript) Templates</a>
</li><li><a href="https://ruby-doc.org/stdlib-1.9.3/libdoc/erb/rdoc/ERB.html">ERB (Embedded Ruby)</a>
</li><li><a href="https://freemarker.apache.org/">FreeMarker</a>
</li><li><a href="https://genshi.edgewall.org/">Genshi</a>
</li><li><a href="https://handlebarsjs.com/">Handlebars</a>
</li><li><a href="https://helpx.adobe.com/experience-manager/htl/using/getting-started.html">HTL (HTML Templating Language)</a>
</li><li><a href="https://www.w3.org/TR/html52/">HTML</a>
</li><li><a href="https://jekyllrb.com/docs/liquid/">Jekyll</a>
</li><li><a href="http://jinja.pocoo.org/">Jinja</a>
</li><li><a href="https://github.com/eclipse-ee4j/jstl-api">JSTL (Java Standard Tag Library)</a>
</li><li><a href="https://shopify.github.io/liquid/">Liquid</a>
</li><li><a href="https://mustache.github.io/">Mustache</a>
</li><li><a href="https://mozilla.github.io/nunjucks/">Nunjucks</a>
</li><li><a href="https://www.iso.org/standard/16387.html">SGML</a>
</li><li><a href="https://docs.silverstripe.org/en/4/developer_guides/templates/syntax/">SilverStripe</a>
</li><li><a href="http://blazejs.org/guide/spacebars.html">Spacebars templates</a>
</li><li><a href="https://www.thymeleaf.org/doc/tutorials/3.0/usingthymeleaf.html">ThymeLeaf</a>
</li><li><a href="https://underscorejs.org/#template">Underscore Templates (TPL)</a>
</li><li><a href="https://twig.symfony.com/">Twig</a>
</li><li><a href="https://docs.vapor.codes/3.0/leaf/overview/">Vapor Leaf</a>
</li><li><a href="https://github.com/kirbysayshi/vash">Vash</a>
</li><li><a href="https://phalcon-php-framework-documentation.readthedocs.io/en/latest/reference/volt.html">Volt</a>
</li><li><a href="https://www.w3.org/TR/REC-xml/">XML</a>
</li><li><a href="https://www.w3.org/standards/xml/transformation">XSLT</a>
</li></ul></li><li>script <ul><li><a href="https://flow.org/">Flow</a>
</li><li><a href="https://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf">JavaScript / ECMAScript</a>
</li><li><a href="https://json.org/">JSON</a>
</li><li><a href="https://doc.qt.io/qt-5/qmlfirststeps.html">QML</a>
</li><li><a href="https://reactjs.org/docs/introducing-jsx.html">React JSX</a>
</li><li><a href="https://www.styled-components.com/">styled-components</a>
</li><li><a href="https://github.com/zeit/styled-jsx#readme">styled-jsx</a>
</li><li><a href="https://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.TextField">TSS (Titanium Style Sheets)</a>
</li><li><a href="https://www.typescriptlang.org/docs/handbook/jsx.html">TSX</a>
</li><li><a href="https://www.typescriptlang.org/">TypeScript</a>
</li></ul></li><li>style <ul><li><a href="https://www.w3.org/Style/CSS/#news">CSS</a>
</li><li><a href="http://lesscss.org/">LESS</a>
</li><li><a href="https://postcss.org/">PostCSS</a>
</li><li><a href="https://sass-lang.com/">SCSS (Sass)</a>
</li></ul></li></ul><p><strong>45</strong> total languages</p>
<!-- documentation languages end -->
</div>
</div>
</div>
<div>
<h2>
<button aria-disabled="true" class="heading" role="presentation">API (Options)
<span aria-hidden="true">Show</span>
</button>
</h2>
<div class="content-hide">
<div class="segment">
<h3>Key of terms</h3>
<dl>
<dt>Environment</dt>
<dd>Describes where the option is available, such as whether exclusively used with Node or in a browser.</dd>
<dt>Type</dt>
<dd>The data type of the option's value, such as <em>string</em>, <em>number</em>, or <em>boolean</em>.</dd>
<dt>Mode</dt>
<dd>Some options are only available in certain modes, such as beautification or minification.</dd>
<dt>Lexer</dt>
<dd>Some options are only available to certain language groups. Markup specific options, for example, will not work with JavaScript language.</dd>
<dt>Default</dt>
<dd>The option's default value.</dd>
</dl>
</div>
<ol class="segment" id="options">
<!-- option list start --><li id="attribute_sort"><h4>attribute_sort</h4><ul><li><h5>Description</h5>Alphanumerically sort markup attributes. Attribute sorting is ignored on tags that contain attributes template attributes.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>any</li><li><h5>Lexer</h5>markup</li><li><h5>Default</h5>false</li><li><h5>As labeled in the HTML tool</h5>Sort Attributes</li></ul></li><li id="attribute_sort_list"><h4>attribute_sort_list</h4><ul><li><h5>Description</h5>A comma separated list of attribute names. Attributes will be sorted according to this list and then alphanumerically. This option requires 'attribute_sort' have a value of true.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>string</li><li><h5>Mode</h5>any</li><li><h5>Lexer</h5>markup</li><li><h5>Default</h5></li><li><h5>As labeled in the HTML tool</h5>Sort Attribute List</li></ul></li><li id="brace_line"><h4>brace_line</h4><ul><li><h5>Description</h5>If true an empty line will be inserted after opening curly braces and before closing curly braces.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>beautify</li><li><h5>Lexer</h5>script</li><li><h5>Default</h5>false</li><li><h5>As labeled in the HTML tool</h5>Brace Lines</li></ul></li><li id="brace_padding"><h4>brace_padding</h4><ul><li><h5>Description</h5>Inserts a space after the start of a container and before the end of the container if the contents of that container are not indented; such as: conditions, function arguments, and escaped sequences of template strings.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>beautify</li><li><h5>Lexer</h5>script</li><li><h5>Default</h5>false</li><li><h5>As labeled in the HTML tool</h5>Brace Padding</li></ul></li><li id="brace_style"><h4>brace_style</h4><ul><li><h5>Description</h5>Emulates JSBeautify's brace_style option using existing Pretty Diff options.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>string</li><li><h5>Mode</h5>beautify</li><li><h5>Lexer</h5>script</li><li><h5>Accepted Values</h5><dl><dt>collapse</dt><dd>Sets options.format_object to 'indent' and options.neverflatten to true.</dd><dt>collapse-preserve-inline</dt><dd>Sets options.bracepadding to true and options.format_object to 'inline'.</dd><dt>expand</dt><dd>Sets options.braces to true, options.format_object to 'indent', and options.neverflatten to true.</dd><dt>none</dt><dd>Ignores this option</dd></dl></li><li><h5>Default</h5>none</li><li><h5>As labeled in the HTML tool</h5>Brace Style</li></ul></li><li id="braces"><h4>braces</h4><ul><li><h5>Description</h5>Determines if opening curly braces will exist on the same line as their condition or be forced onto a new line. (Allman style indentation).</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>beautify</li><li><h5>Lexer</h5>script</li><li><h5>Default</h5>false</li><li><h5>As labeled in the HTML tool</h5>Style of Indent</li></ul></li><li id="case_space"><h4>case_space</h4><ul><li><h5>Description</h5>If the colon separating a case's expression (of a switch/case block) from its statement should be followed by a space instead of indentation, thereby keeping the case on a single line of code.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>beautify</li><li><h5>Lexer</h5>script</li><li><h5>Default</h5>false</li><li><h5>As labeled in the HTML tool</h5>Space Following Case</li></ul></li><li id="color"><h4>color</h4><ul><li><h5>Description</h5>The color scheme of the reports.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>string</li><li><h5>Mode</h5>any</li><li><h5>Lexer</h5>any</li><li><h5>Accepted Values</h5><dl><dt>canvas</dt><dd>A light brown color scheme</dd><dt>shadow</dt><dd>A black and ashen color scheme</dd><dt>white</dt><dd>A white and pale grey color scheme</dd></dl></li><li><h5>Default</h5>white</li><li><h5>As labeled in the HTML tool</h5>Color</li></ul></li><li id="comment_line"><h4>comment_line</h4><ul><li><h5>Description</h5>If a blank new line should be forced above comments.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>beautify</li><li><h5>Lexer</h5>markup</li><li><h5>Default</h5>false</li><li><h5>As labeled in the HTML tool</h5>Force an Empty Line Above Comments</li></ul></li><li id="comments"><h4>comments</h4><ul><li><h5>Description</h5>This will determine whether comments should always start at position 0 of each line or if comments should be indented according to the code.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>beautify</li><li><h5>Lexer</h5>any</li><li><h5>Default</h5>false</li><li><h5>As labeled in the HTML tool</h5>Indent Comments</li></ul></li><li id="complete_document"><h4>complete_document</h4><ul><li><h5>Description</h5>Allows a preference for generating a complete HTML document instead of only generating content.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>any</li><li><h5>Lexer</h5>markup</li><li><h5>Default</h5>false</li><li><h5>As labeled in the HTML tool</h5>Generate A Complete HTML File</li></ul></li><li id="compressed_css"><h4>compressed_css</h4><ul><li><h5>Description</h5>If CSS should be beautified in a style where the properties and values are minifed for faster reading of selectors.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>beautify</li><li><h5>Lexer</h5>style</li><li><h5>Default</h5>false</li><li><h5>As labeled in the HTML tool</h5>Compressed CSS</li></ul></li><li id="conditional"><h4>conditional</h4><ul><li><h5>Description</h5>If true then conditional comments used by Internet Explorer are preserved at minification of markup.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>minify</li><li><h5>Lexer</h5>markup</li><li><h5>Default</h5>false</li><li><h5>As labeled in the HTML tool</h5>IE Comments (HTML Only)</li></ul></li><li id="config"><h4>config</h4><ul><li><h5>Description</h5>By default Pretty Diff will look into the directory structure contain the value of option 'source' for a file named `.prettydiffrc` for saved option settings. This option allows a user to specify any file at any location in the local file system for configuration settings. A value of 'none' tells the application to bypass reading any configuration file.</li><li><h5>Environment</h5>node</li><li><h5>Type</h5>string</li><li><h5>Mode</h5>any</li><li><h5>Lexer</h5>any</li><li><h5>Default</h5></li><li><h5>As labeled in the HTML tool</h5>Custom Config File Location</li></ul></li><li id="content"><h4>content</h4><ul><li><h5>Description</h5>This will normalize all string content to 'text' so as to eliminate some differences from the output.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>diff</li><li><h5>Lexer</h5>any</li><li><h5>Default</h5>false</li><li><h5>As labeled in the HTML tool</h5>Ignore Content</li></ul></li><li id="correct"><h4>correct</h4><ul><li><h5>Description</h5>Automatically correct some sloppiness in code.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>any</li><li><h5>Lexer</h5>any</li><li><h5>Default</h5>false</li><li><h5>As labeled in the HTML tool</h5>Fix Sloppy Code</li></ul></li><li id="crlf"><h4>crlf</h4><ul><li><h5>Description</h5>If line termination should be Windows (CRLF) format. Unix (LF) format is the default.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>any</li><li><h5>Lexer</h5>any</li><li><h5>Default</h5>false</li><li><h5>As labeled in the HTML tool</h5>Line Termination</li></ul></li><li id="css_insert_lines"><h4>css_insert_lines</h4><ul><li><h5>Description</h5>Inserts new line characters between every CSS code block.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>beautify</li><li><h5>Lexer</h5>style</li><li><h5>Default</h5>false</li><li><h5>As labeled in the HTML tool</h5>Insert Empty Lines</li></ul></li><li id="diff"><h4>diff</h4><ul><li><h5>Description</h5>The code sample to be compared to 'source' option. This is required if mode is 'diff'.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>string</li><li><h5>Mode</h5>diff</li><li><h5>Lexer</h5>any</li><li><h5>Default</h5></li><li><h5>As labeled in the HTML tool</h5>Code to Compare</li></ul></li><li id="diff_comments"><h4>diff_comments</h4><ul><li><h5>Description</h5>If true then comments will be preserved so that both code and comments are compared by the diff engine.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>diff</li><li><h5>Lexer</h5>any</li><li><h5>Default</h5>false</li><li><h5>As labeled in the HTML tool</h5>Code Comments</li></ul></li><li id="diff_context"><h4>diff_context</h4><ul><li><h5>Description</h5>This shortens the diff output by allowing a specified number of equivalent lines between each line of difference. This option is only used with diff_format:html.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>number</li><li><h5>Mode</h5>diff</li><li><h5>Lexer</h5>any</li><li><h5>Default</h5>-1</li><li><h5>As labeled in the HTML tool</h5>Context Size</li></ul></li><li id="diff_format"><h4>diff_format</h4><ul><li><h5>Description</h5>The format of the output. The command line output format is text, similar to Unix 'diff'.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>string</li><li><h5>Mode</h5>diff</li><li><h5>Lexer</h5>any</li><li><h5>Accepted Values</h5><dl><dt>html</dt><dd>An HTML format for embedding in web pages, or as a complete web page if document_complete is true.</dd><dt>json</dt><dd>A JSON format.</dd><dt>text</dt><dd>Formatted similar to the Unix 'diff' command line utility.</dd></dl></li><li><h5>Default</h5>text</li><li><h5>As labeled in the HTML tool</h5>Diff Format</li></ul></li><li id="diff_label"><h4>diff_label</h4><ul><li><h5>Description</h5>This allows for a descriptive label for the diff file code of the diff HTML output.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>string</li><li><h5>Mode</h5>diff</li><li><h5>Lexer</h5>any</li><li><h5>Default</h5>New Sample</li><li><h5>As labeled in the HTML tool</h5>Label for Diff Sample</li></ul></li><li id="diff_rendered_html"><h4>diff_rendered_html</h4><ul><li><h5>Description</h5>Compares complete HTML documents and injects custom CSS so that the differences display not in the code, but in the rendered page in a browser. This option is currently confined only to markup languages, read_method file, and mode diff. Option diff_format is ignored.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>diff</li><li><h5>Lexer</h5>markup</li><li><h5>Default</h5>false</li><li><h5>As labeled in the HTML tool</h5>Compare Rendered HTML</li></ul></li><li id="diff_space_ignore"><h4>diff_space_ignore</h4><ul><li><h5>Description</h5>If white space only differences should be ignored by the diff tool.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>diff</li><li><h5>Lexer</h5>any</li><li><h5>Default</h5>false</li><li><h5>As labeled in the HTML tool</h5>Remove White Space</li></ul></li><li id="diff_view"><h4>diff_view</h4><ul><li><h5>Description</h5>This determines whether the diff HTML output should display as a side-by-side comparison or if the differences should display in a single table column.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>string</li><li><h5>Mode</h5>diff</li><li><h5>Lexer</h5>any</li><li><h5>Accepted Values</h5><dl><dt>inline</dt><dd>A single column where insertions and deletions are vertically adjacent.</dd><dt>sidebyside</dt><dd>Two column comparison of changes.</dd></dl></li><li><h5>Default</h5>sidebyside</li><li><h5>As labeled in the HTML tool</h5>Diff View Type</li></ul></li><li id="else_line"><h4>else_line</h4><ul><li><h5>Description</h5>If else_line is true then the keyword 'else' is forced onto a new line.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>beautify</li><li><h5>Lexer</h5>script</li><li><h5>Default</h5>false</li><li><h5>As labeled in the HTML tool</h5>Else On New Line</li></ul></li><li id="end_comma"><h4>end_comma</h4><ul><li><h5>Description</h5>If there should be a trailing comma in arrays and objects. Value "multiline" only applies to modes beautify and diff.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>string</li><li><h5>Mode</h5>beautify</li><li><h5>Lexer</h5>script</li><li><h5>Accepted Values</h5><dl><dt>always</dt><dd>Always ensure there is a tailing comma</dd><dt>never</dt><dd>Remove trailing commas</dd><dt>none</dt><dd>Ignore this option</dd></dl></li><li><h5>Default</h5>never</li><li><h5>As labeled in the HTML tool</h5>Trailing Comma</li></ul></li><li id="end_quietly"><h4>end_quietly</h4><ul><li><h5>Description</h5>A node only option to determine if terminal summary data should be logged to the console.</li><li><h5>Environment</h5>node</li><li><h5>Type</h5>string</li><li><h5>Mode</h5>any</li><li><h5>Lexer</h5>any</li><li><h5>Accepted Values</h5><dl><dt>default</dt><dd>Default minimal summary</dd><dt>log</dt><dd>Verbose logging</dd><dt>quiet</dt><dd>No extraneous logging</dd></dl></li><li><h5>Default</h5>default</li><li><h5>As labeled in the HTML tool</h5>Log Summary to Console</li></ul></li><li id="force_attribute"><h4>force_attribute</h4><ul><li><h5>Description</h5>If all markup attributes should be indented each onto their own line.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>beautify</li><li><h5>Lexer</h5>markup</li><li><h5>Default</h5>false</li><li><h5>As labeled in the HTML tool</h5>Force Indentation of All Attributes</li></ul></li><li id="force_indent"><h4>force_indent</h4><ul><li><h5>Description</h5>Will force indentation upon all content and tags without regard for the creation of new text nodes.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>beautify</li><li><h5>Lexer</h5>markup</li><li><h5>Default</h5>false</li><li><h5>As labeled in the HTML tool</h5>Force Indentation of All Content</li></ul></li><li id="format_array"><h4>format_array</h4><ul><li><h5>Description</h5>Determines if all array indexes should be indented, never indented, or left to the default.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>string</li><li><h5>Mode</h5>beautify</li><li><h5>Lexer</h5>script</li><li><h5>Accepted Values</h5><dl><dt>default</dt><dd>Default formatting</dd><dt>indent</dt><dd>Always indent each index of an array</dd><dt>inline</dt><dd>Ensure all array indexes appear on a single line</dd></dl></li><li><h5>Default</h5>default</li><li><h5>As labeled in the HTML tool</h5>Formatting Arrays</li></ul></li><li id="format_object"><h4>format_object</h4><ul><li><h5>Description</h5>Determines if all object keys should be indented, never indented, or left to the default.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>string</li><li><h5>Mode</h5>beautify</li><li><h5>Lexer</h5>script</li><li><h5>Accepted Values</h5><dl><dt>default</dt><dd>Default formatting</dd><dt>indent</dt><dd>Always indent each key/value pair</dd><dt>inline</dt><dd>Ensure all key/value pairs appear on the same single line</dd></dl></li><li><h5>Default</h5>default</li><li><h5>As labeled in the HTML tool</h5>Formatting Objects</li></ul></li><li id="function_name"><h4>function_name</h4><ul><li><h5>Description</h5>If a space should follow a JavaScript function name.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>beautify</li><li><h5>Lexer</h5>script</li><li><h5>Default</h5>false</li><li><h5>As labeled in the HTML tool</h5>Space After Function Name</li></ul></li><li id="help"><h4>help</h4><ul><li><h5>Description</h5>A node only option to print documentation to the console. The value determines where to wrap text.</li><li><h5>Environment</h5>node</li><li><h5>Type</h5>number</li><li><h5>Mode</h5>any</li><li><h5>Lexer</h5>any</li><li><h5>Default</h5>80</li><li><h5>As labeled in the HTML tool</h5>Help Wrapping Limit</li></ul></li><li id="indent_char"><h4>indent_char</h4><ul><li><h5>Description</h5>The string characters to comprise a single indentation. Any string combination is accepted.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>string</li><li><h5>Mode</h5>beautify</li><li><h5>Lexer</h5>any</li><li><h5>Default</h5> </li><li><h5>As labeled in the HTML tool</h5>Indentation Characters</li></ul></li><li id="indent_level"><h4>indent_level</h4><ul><li><h5>Description</h5>How much indentation padding should be applied to beautification? This option is internally used for code that requires switching between libraries.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>number</li><li><h5>Mode</h5>beautify</li><li><h5>Lexer</h5>any</li><li><h5>Default</h5>0</li><li><h5>As labeled in the HTML tool</h5>Indentation Padding</li></ul></li><li id="indent_size"><h4>indent_size</h4><ul><li><h5>Description</h5>The number of 'indent_char' values to comprise a single indentation.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>number</li><li><h5>Mode</h5>beautify</li><li><h5>Lexer</h5>any</li><li><h5>Default</h5>4</li><li><h5>As labeled in the HTML tool</h5>Indent Size</li></ul></li><li id="jsscope"><h4>jsscope</h4><ul><li><h5>Description</h5>An educational tool to generate HTML output of JavaScript code to identify scope regions and declared references by color. This option is ignored unless the code language is JavaScript or TypeScript.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>string</li><li><h5>Mode</h5>beautify</li><li><h5>Lexer</h5>script</li><li><h5>Accepted Values</h5><dl><dt>html</dt><dd>generates HTML output with escaped angle braces and ampersands for embedding as code, which is handy in code producing tools</dd><dt>none</dt><dd>prevents use of this option</dd><dt>report</dt><dd>generates HTML output that renders in web browsers</dd></dl></li><li><h5>Default</h5>none</li><li><h5>As labeled in the HTML tool</h5>JavaScript Scope Identification</li></ul></li><li id="language"><h4>language</h4><ul><li><h5>Description</h5>The lowercase single word common name of the source code's programming language. The value 'auto' imposes language and lexer auto-detection, which ignores deliberately specified lexer values. The value 'text' is converted to 'auto' if options 'mode' is not 'diff'. Value 'text' allows literal comparisons.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>string</li><li><h5>Mode</h5>any</li><li><h5>Lexer</h5>any</li><li><h5>Default</h5>auto</li><li><h5>As labeled in the HTML tool</h5>Language</li></ul></li><li id="language_default"><h4>language_default</h4><ul><li><h5>Description</h5>The fallback option if option 'lang' is set to 'auto' and a language cannot be detected.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>string</li><li><h5>Mode</h5>any</li><li><h5>Lexer</h5>any</li><li><h5>Default</h5>text</li><li><h5>As labeled in the HTML tool</h5>Language Auto-Detection Default</li></ul></li><li id="language_name"><h4>language_name</h4><ul><li><h5>Description</h5>The formatted proper name of the code sample's language for use in reports read by people.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>string</li><li><h5>Mode</h5>any</li><li><h5>Lexer</h5>any</li><li><h5>Default</h5>JavaScript</li><li><h5>As labeled in the HTML tool</h5>Formatted Name of the Code's Language</li></ul></li><li id="lexer"><h4>lexer</h4><ul><li><h5>Description</h5>This option determines which sets of rules to use in the language parser. If option 'language' has a value of 'auto', which is the default value, this option is ignored. The value 'text' is converted to 'auto' if options 'mode' is not 'diff'. Value 'text' allows literal comparisons.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>string</li><li><h5>Mode</h5>any</li><li><h5>Lexer</h5>any</li><li><h5>Accepted Values</h5><dl><dt>auto</dt><dd>The value 'auto' imposes language and lexer auto-detection, which ignores deliberately specified language values.</dd><dt>markup</dt><dd>parses languages like XML and HTML</dd><dt>script</dt><dd>parses languages with a C style syntax, such as JavaScript</dd><dt>style</dt><dd>parses CSS like languages</dd></dl></li><li><h5>Default</h5>auto</li><li><h5>As labeled in the HTML tool</h5>Parsing Lexer</li></ul></li><li id="list_options"><h4>list_options</h4><ul><li><h5>Description</h5>A Node.js only option that writes current option settings to the console.</li><li><h5>Environment</h5>node</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>any</li><li><h5>Lexer</h5>any</li><li><h5>Default</h5>false</li><li><h5>As labeled in the HTML tool</h5>Options List</li></ul></li><li id="method_chain"><h4>method_chain</h4><ul><li><h5>Description</h5>When to break consecutively chained methods and properties onto separate lines. A negative value disables this option. A value of 0 ensures method chains are never broken.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>number</li><li><h5>Mode</h5>beautify</li><li><h5>Lexer</h5>script</li><li><h5>Default</h5>3</li><li><h5>As labeled in the HTML tool</h5>Method Chains</li></ul></li><li id="minify_keep_comments"><h4>minify_keep_comments</h4><ul><li><h5>Description</h5>Prevents minification from stripping out comments.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>minify</li><li><h5>Lexer</h5>any</li><li><h5>Default</h5>false</li><li><h5>As labeled in the HTML tool</h5>Keep Comments</li></ul></li><li id="minify_wrap"><h4>minify_wrap</h4><ul><li><h5>Description</h5>Whether minified script should wrap after a specified character width. This option requires a value from option 'wrap'.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>minify</li><li><h5>Lexer</h5>script</li><li><h5>Default</h5>false</li><li><h5>As labeled in the HTML tool</h5>Minification Wrapping</li></ul></li><li id="mode"><h4>mode</h4><ul><li><h5>Description</h5>The operation to be performed.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>string</li><li><h5>Mode</h5>any</li><li><h5>Lexer</h5>any</li><li><h5>Accepted Values</h5><dl><dt>beautify</dt><dd>beautifies code and returns a string</dd><dt>diff</dt><dd>returns either command line list of differences or an HTML report</dd><dt>minify</dt><dd>minifies code and returns a string</dd><dt>parse</dt><dd>using option 'parseFormat' returns an object with shallow arrays, a multidimensional array, or an HTML report</dd></dl></li><li><h5>Default</h5>diff</li><li><h5>As labeled in the HTML tool</h5>Mode</li></ul></li><li id="never_flatten"><h4>never_flatten</h4><ul><li><h5>Description</h5>If destructured lists in script should never be flattend.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>beautify</li><li><h5>Lexer</h5>script</li><li><h5>Default</h5>false</li><li><h5>As labeled in the HTML tool</h5>Never Flatten Destructured Lists</li></ul></li><li id="new_line"><h4>new_line</h4><ul><li><h5>Description</h5>Insert an empty line at the end of output.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>any</li><li><h5>Lexer</h5>any</li><li><h5>Default</h5>false</li><li><h5>As labeled in the HTML tool</h5>New Line at End of Code</li></ul></li><li id="no_case_indent"><h4>no_case_indent</h4><ul><li><h5>Description</h5>If a case statement should receive the same indentation as the containing switch block.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>beautify</li><li><h5>Lexer</h5>script</li><li><h5>Default</h5>false</li><li><h5>As labeled in the HTML tool</h5>Case Indentation</li></ul></li><li id="no_lead_zero"><h4>no_lead_zero</h4><ul><li><h5>Description</h5>Whether leading 0s in CSS values immediately preceding a decimal should be removed or prevented.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>any</li><li><h5>Lexer</h5>style</li><li><h5>Default</h5>false</li><li><h5>As labeled in the HTML tool</h5>Leading 0s</li></ul></li><li id="no_semicolon"><h4>no_semicolon</h4><ul><li><h5>Description</h5>Removes semicolons that would be inserted by ASI. This option is in conflict with option 'correct' and takes precedence over conflicting features. Use of this option is a possible security/stability risk.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>beautify</li><li><h5>Lexer</h5>script</li><li><h5>Default</h5>false</li><li><h5>As labeled in the HTML tool</h5>No Semicolons</li></ul></li><li id="node_error"><h4>node_error</h4><ul><li><h5>Description</h5>A Node.js only option if parse errors should be written to the console.</li><li><h5>Environment</h5>node</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>any</li><li><h5>Lexer</h5>any</li><li><h5>Default</h5>false</li><li><h5>As labeled in the HTML tool</h5>Write Parse Errors in Node</li></ul></li><li id="object_sort"><h4>object_sort</h4><ul><li><h5>Description</h5>Sorts markup attributes and properties by key name in script and style.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>beautify</li><li><h5>Lexer</h5>any</li><li><h5>Default</h5>false</li><li><h5>As labeled in the HTML tool</h5>Object/Attribute Sort</li></ul></li><li id="output"><h4>output</h4><ul><li><h5>Description</h5>A file path for which to write output. If this option is not specified output will be printed to the shell.</li><li><h5>Environment</h5>node</li><li><h5>Type</h5>string</li><li><h5>Mode</h5>any</li><li><h5>Lexer</h5>any</li><li><h5>Default</h5></li><li><h5>As labeled in the HTML tool</h5>Output Location</li></ul></li><li id="parse_format"><h4>parse_format</h4><ul><li><h5>Description</h5>Determines the output format for 'parse' mode.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>string</li><li><h5>Mode</h5>parse</li><li><h5>Lexer</h5>any</li><li><h5>Accepted Values</h5><dl><dt>htmltable</dt><dd>generates the 'table' type output for the DOM but escapes the HTML tags for rendering as HTML code in a HTML tool</dd><dt>parallel</dt><dd>returns an object containing series of parallel arrays</dd><dt>sequential</dt><dd>returns an array where each index is a child object containing the parsed token and all descriptive data</dd><dt>table</dt><dd>generates a colorful grid of output for either the dom or command line interface</dd></dl></li><li><h5>Default</h5>parallel</li><li><h5>As labeled in the HTML tool</h5>Parse Format</li></ul></li><li id="parse_space"><h4>parse_space</h4><ul><li><h5>Description</h5>Whether whitespace tokens should be included in markup parse output.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>parse</li><li><h5>Lexer</h5>markup</li><li><h5>Default</h5>false</li><li><h5>As labeled in the HTML tool</h5>Retain White Space Tokens in Parse Output</li></ul></li><li id="preserve"><h4>preserve</h4><ul><li><h5>Description</h5>The maximum number of consecutive empty lines to retain.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>number</li><li><h5>Mode</h5>beautify</li><li><h5>Lexer</h5>any</li><li><h5>Default</h5>0</li><li><h5>As labeled in the HTML tool</h5>Preserve Consecutive New Lines</li></ul></li><li id="preserve_comment"><h4>preserve_comment</h4><ul><li><h5>Description</h5>Prevent comment reformatting due to option wrap.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>beautify</li><li><h5>Lexer</h5>any</li><li><h5>Default</h5>false</li><li><h5>As labeled in the HTML tool</h5>Eliminate Word Wrap Upon Comments</li></ul></li><li id="preserve_text"><h4>preserve_text</h4><ul><li><h5>Description</h5>If text in the provided markup code should be preserved exactly as provided. This option eliminates beautification and wrapping of text content.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>any</li><li><h5>Lexer</h5>markup</li><li><h5>Default</h5>false</li><li><h5>As labeled in the HTML tool</h5>Preserve Markup Text White Space</li></ul></li><li id="quote"><h4>quote</h4><ul><li><h5>Description</h5>If true and mode is 'diff' then all single quote characters will be replaced by double quote characters in both the source and diff file input so as to eliminate some differences from the diff report HTML output.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>diff</li><li><h5>Lexer</h5>any</li><li><h5>Default</h5>false</li><li><h5>As labeled in the HTML tool</h5>Normalize Quotes</li></ul></li><li id="quote_convert"><h4>quote_convert</h4><ul><li><h5>Description</h5>If the quotes of script strings or markup attributes should be converted to single quotes or double quotes.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>string</li><li><h5>Mode</h5>any</li><li><h5>Lexer</h5>any</li><li><h5>Accepted Values</h5><dl><dt>double</dt><dd>Converts single quotes to double quotes</dd><dt>none</dt><dd>Ignores this option</dd><dt>single</dt><dd>Converts double quotes to single quotes</dd></dl></li><li><h5>Default</h5>none</li><li><h5>As labeled in the HTML tool</h5>Indent Size</li></ul></li><li id="read_method"><h4>read_method</h4><ul><li><h5>Description</h5>The option determines how Node.js should receive input. All output will be printed to the shell unless the option 'output' is specified, which will write output to a file.</li><li><h5>Environment</h5>node</li><li><h5>Type</h5>string</li><li><h5>Mode</h5>any</li><li><h5>Lexer</h5>any</li><li><h5>Accepted Values</h5><dl><dt>auto</dt><dd>changes to value subdirectory, file, or screen depending on source resolution</dd><dt>directory</dt><dd>process all files in the specified directory only</dd><dt>file</dt><dd>reads a file and outputs to a file. file requires option 'output'</dd><dt>screen</dt><dd>reads from screen and outputs to screen</dd><dt>subdirectory</dt><dd>process all files in a directory and its subdirectories</dd></dl></li><li><h5>Default</h5>auto</li><li><h5>As labeled in the HTML tool</h5>Read Method</li></ul></li><li id="selector_list"><h4>selector_list</h4><ul><li><h5>Description</h5>If comma separated CSS selectors should present on a single line of code.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>beautify</li><li><h5>Lexer</h5>style</li><li><h5>Default</h5>false</li><li><h5>As labeled in the HTML tool</h5>Indent Size</li></ul></li><li id="semicolon"><h4>semicolon</h4><ul><li><h5>Description</h5>If true and mode is 'diff' and lang is 'javascript' all semicolon characters that immediately precede any white space containing a new line character will be removed so as to eliminate some differences from the code comparison.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>diff</li><li><h5>Lexer</h5>script</li><li><h5>Default</h5>false</li><li><h5>As labeled in the HTML tool</h5>Indent Size</li></ul></li><li id="source"><h4>source</h4><ul><li><h5>Description</h5>The source code or location for interpretation. This option is required for all modes.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>string</li><li><h5>Mode</h5>any</li><li><h5>Lexer</h5>any</li><li><h5>Default</h5></li><li><h5>As labeled in the HTML tool</h5>Source Sample</li></ul></li><li id="source_label"><h4>source_label</h4><ul><li><h5>Description</h5>This allows for a descriptive label of the source file code for the diff HTML output.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>string</li><li><h5>Mode</h5>diff</li><li><h5>Lexer</h5>any</li><li><h5>Default</h5>Source Sample</li><li><h5>As labeled in the HTML tool</h5>Label for Source Sample</li></ul></li><li id="space"><h4>space</h4><ul><li><h5>Description</h5>Inserts a space following the function keyword for anonymous functions.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>beautify</li><li><h5>Lexer</h5>script</li><li><h5>Default</h5>true</li><li><h5>As labeled in the HTML tool</h5>Function Space</li></ul></li><li id="space_close"><h4>space_close</h4><ul><li><h5>Description</h5>Markup self-closing tags end will end with ' />' instead of '/>'.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>beautify</li><li><h5>Lexer</h5>markup</li><li><h5>Default</h5>false</li><li><h5>As labeled in the HTML tool</h5>Close Markup Self-Closing Tags with a Space</li></ul></li><li id="styleguide"><h4>styleguide</h4><ul><li><h5>Description</h5>Provides a collection of option presets to easily conform to popular JavaScript style guides.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>string</li><li><h5>Mode</h5>beautify</li><li><h5>Lexer</h5>script</li><li><h5>Accepted Values</h5><dl><dt>airbnb</dt><dd>https://github.com/airbnb/javascript</dd><dt>crockford</dt><dd>http://jslint.com/</dd><dt>google</dt><dd>https://google.github.io/styleguide/jsguide.html</dd><dt>jquery</dt><dd>https://contribute.jquery.org/style-guide/js/</dd><dt>jslint</dt><dd>http://jslint.com/</dd><dt>mediawiki</dt><dd>https://www.mediawiki.org/wiki/Manual:Coding_conventions/JavaScript</dd><dt>mrdoob</dt><dd>https://github.com/mrdoob/three.js/wiki/Mr.doob's-Code-Style%E2%84%A2</dd><dt>none</dt><dd>Ignores this option</dd><dt>semistandard</dt><dd>https://github.com/Flet/semistandard</dd><dt>standard</dt><dd>https://standardjs.com/</dd><dt>yandex</dt><dd>https://github.com/ymaps/codestyle/blob/master/javascript.md</dd></dl></li><li><h5>Default</h5>none</li><li><h5>As labeled in the HTML tool</h5>Script Styleguide</li></ul></li><li id="summary_only"><h4>summary_only</h4><ul><li><h5>Description</h5>Node only option to output only number of differences.</li><li><h5>Environment</h5>node</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>diff</li><li><h5>Lexer</h5>any</li><li><h5>Default</h5>false</li><li><h5>As labeled in the HTML tool</h5>Output Diff Only Without A Summary</li></ul></li><li id="tag_merge"><h4>tag_merge</h4><ul><li><h5>Description</h5>Allows immediately adjacement start and end markup tags of the same name to be combined into a single self-closing tag.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>any</li><li><h5>Lexer</h5>markup</li><li><h5>Default</h5>false</li><li><h5>As labeled in the HTML tool</h5>Merge Adjacent Start and End tags</li></ul></li><li id="tag_sort"><h4>tag_sort</h4><ul><li><h5>Description</h5>Sort child items of each respective markup parent element.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>any</li><li><h5>Lexer</h5>markup</li><li><h5>Default</h5>false</li><li><h5>As labeled in the HTML tool</h5>Sort Markup Child Items</li></ul></li><li id="ternary_line"><h4>ternary_line</h4><ul><li><h5>Description</h5>If ternary operators in JavaScript ? and : should remain on the same line.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>beautify</li><li><h5>Lexer</h5>script</li><li><h5>Default</h5>false</li><li><h5>As labeled in the HTML tool</h5>Keep Ternary Statements On One Line</li></ul></li><li id="top_comments"><h4>top_comments</h4><ul><li><h5>Description</h5>If mode is 'minify' this determines whether comments above the first line of code should be kept.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>minify</li><li><h5>Lexer</h5>any</li><li><h5>Default</h5>false</li><li><h5>As labeled in the HTML tool</h5>Retain Comment At Code Start</li></ul></li><li id="unformatted"><h4>unformatted</h4><ul><li><h5>Description</h5>If markup tags should have their insides preserved. This option is only available to markup and does not support child tokens that require a different lexer.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>any</li><li><h5>Lexer</h5>markup</li><li><h5>Default</h5>false</li><li><h5>As labeled in the HTML tool</h5>Markup Tag Preservation</li></ul></li><li id="variable_list"><h4>variable_list</h4><ul><li><h5>Description</h5>If consecutive JavaScript variables should be merged into a comma separated list or if variables in a list should be separated.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>string</li><li><h5>Mode</h5>any</li><li><h5>Lexer</h5>script</li><li><h5>Accepted Values</h5><dl><dt>each</dt><dd>Ensurce each reference is a single declaration statement.</dd><dt>list</dt><dd>Ensure consecutive declarations are a comma separated list.</dd><dt>none</dt><dd>Ignores this option.</dd></dl></li><li><h5>Default</h5>none</li><li><h5>As labeled in the HTML tool</h5>Variable Declaration Lists</li></ul></li><li id="version"><h4>version</h4><ul><li><h5>Description</h5>A Node.js only option to write the version information to the console.</li><li><h5>Environment</h5>node</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>any</li><li><h5>Lexer</h5>any</li><li><h5>Default</h5>false</li><li><h5>As labeled in the HTML tool</h5>Version</li></ul></li><li id="vertical"><h4>vertical</h4><ul><li><h5>Description</h5>If lists of assignments and properties should be vertically aligned. This option is not used with the markup lexer.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>boolean</li><li><h5>Mode</h5>beautify</li><li><h5>Lexer</h5>any</li><li><h5>Default</h5>false</li><li><h5>As labeled in the HTML tool</h5>Vertical Alignment</li></ul></li><li id="wrap"><h4>wrap</h4><ul><li><h5>Description</h5>Character width limit before applying word wrap. A 0 value disables this option. A negative value concatenates script strings.</li><li><h5>Environment</h5>any</li><li><h5>Type</h5>number</li><li><h5>Mode</h5>any</li><li><h5>Lexer</h5>any</li><li><h5>Default</h5>0</li><li><h5>As labeled in the HTML tool</h5>Wrap</li></ul></li>
<!-- option list end -->
</ol>
</div>
</div>
<div>
<h2>
<button aria-disabled="true" class="heading" role="presentation">Run the Application
<span aria-hidden="true">Show</span>
</button>
</h2>
<div class="content-hide">
<div class="segment" id="getcode">
<h3>Get the Code</h3>
<p>Various options are available for greater portability</p>
<ul>
<li>
<h4>Github</h4>
<p>
<code>git clone https://github.com/prettydiff/prettydiff.git</code>
</p>
</li>
<li>
<h4>NPM, Pretty Diff</h4>
<p>Pretty Diff is available on NPM at <a href="https://www.npmjs.com/package/prettydiff">https://www.npmjs.com/package/prettydiff</a>.</p>
</li>
</ul>
</div>
<div class="segment" id="runcode">
<h3>Setup/Run the Application</h3>
<h4>Setup as a local application</h4>
<ol>
<li><code>git clone https://github.com/prettydiff/prettydiff.git</code></li>
<li><code>cd prettydiff</code></li>
<li><code>npm install typescript -g</code></li>
<li><code>npm install eslint -g</code></li>
<li><code>npm install</code></li>
<li><code>tsc --pretty</code></li>
<li><code>node js/services build</code></li>
</ol>
<h4>Setup as a global NPM package</h4>
<ol>
<li><code>npm install typescript -g</code></li>
<li><code>npm install eslint -g</code></li>
<li><code>npm install prettydiff -g</code></li>
<li><code>prettydiff build</code></li>
</ol>
<p>To get started with the application on the command line try the <em>commands</em> command to see a list of available features and detailed instructions: <code>node js/services commands</code></p>
<p>To run the application in a web browser with Pretty Diff's HTML execute the <em>server</em> command: <code>node js/services server</code> or simply navigate your browser to the project's <em>index.xhtml</em> file in the local filesystem.</p>
<p>To run the application in a different browser application simply reference or include the built <em>js/browser.js</em> file. See the <a href="tests/browser.html">third party demo</a> for an example.</p>
</div>
<div class="segment" id="prettydiffrc">
<h3>The .prettydiffrc File</h3>
<p>To ease configuration Pretty Diff provides support for a <a href=".prettydiffrc">.prettydiffrc</a> file that stores option settings as a sort of saved preferences. The .prettydiffrc file is only used when the application is executed via Node.js via the supplied <em>js/services.js</em> file, but is checked each time the application executes. This file supports two formats: JavaScript logic and JSON. Options <strong>api</strong>, <strong>diff</strong>, and <strong>source</strong> are not supported in the .prettydiffrc file.</p>
<p>Pretty Diff will look for the .prettydiffrc file starting in the directory specified or the directory containing a specified file. If no .prettydiffrc file is present Pretty Diff will check the next higher directory until reaching root. If the option <em>read_method</em> is value <em>screen</em> or <em>auto</em> and resolves to value screen then the starting location to look for the .prettydiffrc file will be the terminal's current working directory.</p>
<h4>JSON Format</h4>
<p>In order for the options to be accepted by the application the provided options must match a defined option name and the corresponding value must be the proper data type. In the case where an option is string type and accepts a specified set of values the specified value much match one of the supported value names. Here are some examples:</p>
<p><strong>Good</strong> <code>{"indent_size": 6, "format_object": "inline"}</code></p>
<p><strong>Bad</strong> <code>{"indent_size": " ", "format_object": "inline"}</code> This is bad, because the "indent_size" option is provided a value with the incorrect data type. It will be ignored from the application, but the specified "format_object" option will be accepted.</p>
<p><strong>Bad</strong> <code>{"indent_size": 3, "format_object": "never"}</code> The value for option "format_object" is the correct data type, but that option accepts one of three values and "never" is not a supported value. Pretty Diff will accept the "indent_size" option with value 3, but will ignore the specified "format_object".</p>
<h4>JavaScript Format</h4>
<p>To give users greater control and flexibility over the application a JavaScript format is also accepted. This will allow users to specify options conditionally. Please start with this following template:</p>
<p>
<code>(function rc() {</code>
<code> "use strict";</code>
<code> const rclogic = function rc_logic(options) {</code>
<code> // edit below this line</code>
<code> </code>
<code> </code>
<code> </code>
<code> </code>
<code> </code>
<code> </code>
<code> </code>
<code> // edit above this line</code>
<code> return options;</code>
<code> };</code>
<code> module.exports = rclogic;</code>
<code>}());</code>
</p>
<p>JavaScript logic that deviates from the template may result in an error causing the Pretty Diff application to no longer run. For security concerns no use of <em>require</em>, <em>import</em>, and no other use of <em>export</em> is permitted. Ignoring these security concerns will cause the file to be ignored. The options must be assigned with conforming value data types exactly as specified under the <em>JSON Format</em> section in order to be accepted. Examples:</p>
<p>
<code>(function rc() {</code>
<code> "use strict";</code>
<code> const rclogic = function rc_logic(options) {</code>
<code> // edit below this line</code>
<code> </code>
<code> if (options.mode === "beautify" && options.lexer === "style") {</code>
<code> options.indent_size = 6;</code>
<code> }</code>
<code> </code>
<code> if (options.source.length > 2500) {</code>
<code> options.indent_size = 2;</code>
<code> }</code>
<code> </code>
<code> // edit above this line</code>
<code> return options;</code>
<code> };</code>
<code> module.exports = rclogic;</code>
<code>}());</code>
</p>
</div>
</div>
</div>
<div>
<h2>
<button aria-disabled="true" class="heading" role="presentation">License
<span aria-hidden="true">Show</span>
</button>
</h2>
<div class="content-hide">
<div class="segment">
<h3>@source</h3>
<p>
<a href="https://github.com/prettydiff/prettydiff">https://github.com/prettydiff/prettydiff</a>
</p>
</div>
<div class="segment">
<h3>@documentation</h3>
<p>
<a href="https://prettydiff.com/documentation.xhtml">https://prettydiff.com/documentation.xhtml</a>
</p>
</div>
<div class="segment" id="license">
<p>Prettydiff created by Austin Cheney originally on 3 Mar 2009.
https://prettydiff.com/</p>
<p>As of version 2.1.17 Pretty Diff is licensed under CC0. Please see
<a href="license">license</a> for additional information.</p>
</div>
</div>
</div>
<div>
<h2>
<button aria-disabled="true" class="heading" role="presentation">Additional Features
<span aria-hidden="true">Show</span>
</button>
</h2>
<div class="content-hide">
<div class="segment" id="precedence">
<h3>Precedence</h3>
<p>Pretty Diff sets option values according to this order of precedence from
highest priority to lowest:</p>
<ol>
<li>The
<a href="#styleguide">styleguide</a>
option, which is only used in the
<a href="beautify/script.ts">beautify/script.ts</a>
library.</li>
<li>The
<a href="#comment">Pretty Diff comment</a>.</li>
<li>User supplied options</li>
<li>Default option values</li>
</ol>
</div>
<!--div class="segment" id="prettydifrc">
<h3>The
<a href=".prettydiffrc">.prettydiffrc</a>
File</h3>
<p>A configuration file is available for command line execution via the supplied
<a href="api/node-local.js">api/node-local.js</a>
file. Two separate formats are accepted:</p>
<ul>
<li>JSON</li>
<li>JavaScript object</li>
</ul>
<p>The JSON format is easy to write and validate, but it is a static format. If
your desired option and settings never change then this is the ideal format.</p>
<p>A second format is available for advanced configurability. Some users require
certain features for particular languages, modes, or other heuristics. For
example auto-correction might be desired for JavaScript minification, but not
XML beautification. This second format is JavaScript code, which allows a user
to write and supply options against a set of conditions of their choosing. The
code supplied by default in the .prettydiffrc file allows a template by which
users can achieve this format directly without worrying about application and
delivery concerns.</p>
</div-->
<div class="segment" id="comment">
<h3>Pretty Diff Comment</h3>
<p>The Pretty Diff option comment is similar in convention to the JSLint option
comment. In the case where multiple Pretty Diff option comments are present in a
document only the first will be processed. If in diff mode and an option comment
is present in the diff code but not the source code then this option comment
will be processed. In order for the option comment to be recognized it must
start with
<strong>prettydiff.com</strong>. The options are listed in this comment separated by commas
as a colon separated name value pair. The options match the exact value
definition for the Pretty Diff application properties above and options that
allow abstract values must have their values enclosed in either single or double
quotes. The options can be listed in any order. The option comment should be
separated from other comments to prevent any possibility of corrupted
interpretation. These are examples of appropriate option strings:</p>
<ul>
<li>
<code>/*prettydiff.com mode:beautify, language:javascript, indent_char:"abc"*/</code>
</li>
<li>
<code><!--prettydiff.com mode: beautify, language: javascript,
indent_char: "abc", html: true --></code>
</li>
</ul>
</div>
<div class="segment" id="parameters">
<h3>Web Tool URI Parameters</h3>
<dl>
<dt>ace</dt>
<dd>If this parameter is provided with a false value the Ace code editor will be
discarded in favor of regular HTML textarea elements.</dd>
<dt>localstorage</dt>
<dd>Disables or enables all storage in the browser.</dd>
</dl>
<p>Any defined option name is also supported as a parameter.</p>
<p>Here is an example:
<code>https://prettydiff.com/?source=https://duckduckgo.com&mode=beautify&correct=true&localstorage=false</code>
</p>
</div>
</div>
</div>
<div>
<h2>
<button aria-disabled="true" class="heading" role="presentation">Contributor Information
<span aria-hidden="true">Show</span>
</button>
</h2>
<div class="content-hide">
<div class="segment">
<h3>Contribution Guide</h3>
<p>For questions, features, or bug reports please open an issue on
<a href="https://github.com/prettydiff/prettydiff/issues">Github</a>. If you are executing from the command line insert the <em>debug</em> word at the end of your command and Pretty Diff will generate an issue template in markdown format that you can simply copy and paste into Github.</p>
<p>If you wish to propose code changes then follow these steps:</p>
<ol>
<li>Fork the repository on Github and then clone down the fork to your local computer.</li>
<li>Create a new branch for your changes:
<code>git checkout -b <em>branchName</em></code>
</li>
<li>Create test units. A pull request will be rejected without tests unless there is a strong expection. The build process employs different kinds of tests.
<ul>
<li>The <strong>simulation</strong> command runs just the simulation tests. These tests validate features of the command line operation. These tests are stored in the file <em>tests/simulations.ts</em>.</li>
<li>The <strong>validation</strong> command runs the code unit tests that validate the beautification and minification functions. These tests are stored in the <em>tests/formatted</em> and <em>tests/raw</em> directories. A file in the raw directory containing a test unit is compared against a same named file in the formatted directory storing the Pretty Diff output.</li>
<li>The diff tests are execution as a part of the simulation tests. The code units for the diff tests are stored in the directories <em>tests/diffbase</em> and <em>tests/diffnew</em>.</li>
<li>The parser has its own unit tests that are part of that project. Please see its Github repository: <a href="http://github.com/unibeautify/sparser">sparser</a>.</li>
</ul>
</li>
<li>Run the unit tests to verify if your changes are breaking things:
<code>node js/services test</code>
</li>
<li>Finally, open a pull request on Github or if you are having trouble with the build open a Github issue and ask for help.</li>
</ol>
</div>
<div class="segment">
<h3>Troubleshooting Help</h3>
<p>A few helpful tips in case you get stuck.</p>
<ul>
<li>If an update to the code breaks the build and the application can no longer build try recompiling from TypeScript and then running the Pretty Diff build again. The command is <code>tsc --pretty</code>.</li>
<li>Ensure dependencies are up to date. Try running <code>npm update</code>. A version mismatch between Pretty Diff and the parser could result in unpredictable behavior.</li>
<li>If you need help generating the appropriate details for a Github issue try using the <em>debug</em> feature. Simply run your command on the terminal and add <em>debug</em> or <em>prettydiff_debug</em> to generate an issue template in markdown format.</li>
<li>When everything seems correct on the Pretty Diff side but the result is still wrong there could be a defect in the parser. Clone the parser as a separate project and run its tests by using the <em>validation</em> command. You could also use the parser's <em>server</em> command to run a frontend in your browser that is easier to read. The parser is at <a href="http://github.com/unibeautify/sparser">sparser</a></li>
<li>If you modify the build code you have to rebuild twice to test the changes. This is because the first build compiles the updated code and the second build executes the updated code.</li>
</ul>
</div>
</div>
</div>
</section>
</div>
<script src="js/webtool.js?1567466257926" type="application/javascript"></script>
</body>
</html>