diff --git a/api/mode.ts b/api/mode.ts
new file mode 100644
index 00000000..371cd055
--- /dev/null
+++ b/api/mode.ts
@@ -0,0 +1,762 @@
+/*global prettydiff*/
+function mode(diffmeta?:diffmeta):string {
+ "use strict";
+ const pdcomment = function mode_pdcomment():void {
+ const ops:any = prettydiff.sparser.options;
+ let sindex:number = options.source.search(/((\/(\*|\/))|
+ //
+ //
+ // - Parsing Considerations:
+ // * there may be any amount of space at the start or end of the comment
+ // * "prettydiff.com" must exist at the start of the comment
+ // * comment must exist prior to non-comment tokens (near top of code)
+ // * parameters are name value pairs separated by white space
+ // * the delimiter separating name and value is either ":" or "=" characters
+
+ if ((sindex > -1 && (sindex === 0 || "\"':".indexOf(options.source.charAt(sindex - 1)) < 0)) || (options.mode === "diff" && dindex > -1 && (dindex === 0 || "\"':".indexOf(options.diff.charAt(dindex - 1)) < 0))) {
+ let pdcom:number = sindex,
+ a:number = (pdcom > -1)
+ ? pdcom
+ : dindex,
+ b:number = 0,
+ quote:string = "",
+ item:string = "",
+ lang:string = "",
+ lex:string = "",
+ valkey:string[] = [],
+ op:string[] = [];
+ const ops:string[] = [],
+ source:string = (pdcom > -1)
+ ? options.source
+ : options.diff,
+ len:number = source.length,
+ comment:string = (source.charAt(a) === "<")
+ ? "") {
+ break;
+ }
+ if (comment === "//" && source.charAt(a) === "\n") {
+ break;
+ }
+ if (comment === "/\u002a" && source.slice(a - 1, a + 1) === "\u002a/") {
+ break;
+ }
+ } else if (source.charAt(a) === quote && quote !== "${") {
+ quote = "";
+ } else if (quote === "`" && source.slice(a, a + 2) === "${") {
+ quote = "${";
+ } else if (quote === "${" && source.charAt(a) === "}") {
+ quote = "`";
+ }
+ }
+ a = a + 1;
+ } while (a < len);
+ if (b > 0) {
+ quote = source.slice(b, a + 1);
+ if (comment === "
brace_line
Description
If true an empty line will be inserted after opening curly braces and before closing curly braces.Environment
anyType
booleanMode
beautifyLexer
scriptDefault
falseAs labeled in the HTML tool
Brace Lines
brace_padding
Description
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.Environment
anyType
booleanMode
beautifyLexer
scriptDefault
falseAs labeled in the HTML tool
Brace Padding
brace_style
Description
Emulates JSBeautify's brace_style option using existing Pretty Diff options.Environment
anyType
stringMode
beautifyLexer
scriptAccepted Values
- collapse
- Sets options.format_object to 'indent' and options.neverflatten to true.
- collapse-preserve-inline
- Sets options.bracepadding to true and options.format_object to 'inline'.
- expand
- Sets options.braces to true, options.format_object to 'indent', and options.neverflatten to true.
- none
- Ignores this option
Default
noneAs labeled in the HTML tool
Brace Style
braces
Description
Determines if opening curly braces will exist on the same line as their condition or be forced onto a new line.Environment
anyType
booleanMode
beautifyLexer
scriptDefault
falseAs labeled in the HTML tool
Style of Indent
color
Description
The color scheme of the reports.Environment
anyType
stringMode
anyLexer
anyAccepted Values
- canvas
- A light brown color scheme
- shadow
- A black and ashen color scheme
- white
- A white and pale grey color scheme
Default
whiteAs labeled in the HTML tool
Color
complete_document
Description
Allows a preference for generating a complete HTML document instead of only generating content.Environment
anyType
booleanMode
anyLexer
markupDefault
falseAs labeled in the HTML tool
Generate A Complete HTML File
compressed_css
Description
If CSS should be beautified in a style where the properties and values are minifed for faster reading of selectors.Environment
anyType
booleanMode
beautifyLexer
styleDefault
falseAs labeled in the HTML tool
Compressed CSS
conditional
Description
If true then conditional comments used by Internet Explorer are preserved at minification of markup.Environment
anyType
booleanMode
minifyLexer
markupDefault
falseAs labeled in the HTML tool
IE Comments (HTML Only)
content
Description
This will normalize all string content to 'text' so as to eliminate some differences from the output.Environment
anyType
booleanMode
diffLexer
anyDefault
falseAs labeled in the HTML tool
Ignore Content
correct
Description
Automatically correct some sloppiness in code.Environment
anyType
booleanMode
anyLexer
anyDefault
falseAs labeled in the HTML tool
Fix Sloppy Code
crlf
Description
If line termination should be Windows (CRLF) format. Unix (LF) format is the default.Environment
anyType
booleanMode
anyLexer
anyDefault
falseAs labeled in the HTML tool
Line Termination
css_insert_lines
Description
Inserts new line characters between every CSS code block.Environment
anyType
booleanMode
beautifyLexer
styleDefault
falseAs labeled in the HTML tool
Insert Empty Lines
diff
Description
The code sample to be compared to 'source' option. This is required if mode is 'diff'.Environment
anyType
stringMode
diffLexer
anyDefault
As labeled in the HTML tool
Code to Compare
diff_context
Description
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.Environment
anyType
numberMode
diffLexer
anyDefault
-1As labeled in the HTML tool
Context Size
diff_format
Description
The format of the output. The command line output format is text, similar to Unix 'diff'.Environment
anyType
stringMode
diffLexer
anyAccepted Values
- html
- An HTML format for embedding in web pages, or as a complete web page if document_complete is true.
- json
- A JSON format.
- text
- Formatted similar to the Unix 'diff' command line utility.
Default
textAs labeled in the HTML tool
Diff Format
diff_label
Description
This allows for a descriptive label for the diff file code of the diff HTML output.Environment
anyType
stringMode
diffLexer
anyDefault
New SampleAs labeled in the HTML tool
Label for Diff Sample
diff_rendered_html
Description
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.Environment
anyType
booleanMode
diffLexer
markupDefault
falseAs labeled in the HTML tool
Compare Rendered HTML
diff_space_ignore
Description
If white space only differences should be ignored by the diff tool.Environment
anyType
booleanMode
diffLexer
anyDefault
falseAs labeled in the HTML tool
Remove White Space
diff_view
Description
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.Environment
anyType
stringMode
diffLexer
anyAccepted Values
- inline
- A single column where insertions and deletions are vertically adjacent.
- sidebyside
- Two column comparison of changes.
Default
sidebysideAs labeled in the HTML tool
Diff View Type
else_line
Description
If else_line is true then the keyword 'else' is forced onto a new line.Environment
anyType
booleanMode
beautifyLexer
scriptDefault
falseAs labeled in the HTML tool
Else On New Line
end
Description
The last index to process. This option is useful internally when recursively sliding between various libraries. The default value of 0 means to ignore this option.Environment
anyType
numberMode
anyLexer
anyDefault
0As labeled in the HTML tool
End Index
end_comma
Description
If there should be a trailing comma in arrays and objects. Value "multiline" only applies to modes beautify and diff.Environment
anyType
stringMode
beautifyLexer
scriptAccepted Values
- always
- Always ensure there is a tailing comma
- never
- Remove trailing commas
- none
- Ignore this option
Default
neverAs labeled in the HTML tool
Trailing Comma
end_quietly
Description
A node only option to determine if terminal summary data should be logged to the console.Environment
nodeType
stringMode
anyLexer
anyAccepted Values
- default
- Default minimal summary
- log
- Verbose logging
- quiet
- No extraneous logging
Default
defaultAs labeled in the HTML tool
Log Summary to Console
force_attribute
Description
If all markup attributes should be indented each onto their own line.Environment
anyType
booleanMode
beautifyLexer
markupDefault
falseAs labeled in the HTML tool
Force Indentation of All Attributes
force_indent
Description
Will force indentation upon all content and tags without regard for the creation of new text nodes.Environment
anyType
booleanMode
beautifyLexer
markupDefault
falseAs labeled in the HTML tool
Force Indentation of All Content
format_array
Description
Determines if all array indexes should be indented, never indented, or left to the default.Environment
anyType
stringMode
beautifyLexer
scriptAccepted Values
- default
- Default formatting
- indent
- Always indent each index of an array
- inline
- Ensure all array indexes appear on a single line
Default
defaultAs labeled in the HTML tool
Formatting Arrays
format_object
Description
Determines if all object keys should be indented, never indented, or left to the default.Environment
anyType
stringMode
beautifyLexer
scriptAccepted Values
- default
- Default formatting
- indent
- Always indent each key/value pair
- inline
- Ensure all key/value pairs appear on the same single line
Default
defaultAs labeled in the HTML tool
Formatting Objects
function_name
Description
If a space should follow a JavaScript function name.Environment
anyType
booleanMode
beautifyLexer
scriptDefault
falseAs labeled in the HTML tool
Space After Function Name
help
Description
A node only option to print documentation to the console. The value determines where to wrap text.Environment
nodeType
numberMode
anyLexer
anyDefault
80As labeled in the HTML tool
Help Wrapping Limit
indent_char
Description
The string characters to comprise a single indentation. Any string combination is accepted.Environment
anyType
stringMode
beautifyLexer
anyDefault
As labeled in the HTML tool
Indentation Characters
indent_level
Description
How much indentation padding should be applied to beautification? This option is internally used for code that requires switching between libraries.Environment
anyType
numberMode
beautifyLexer
anyDefault
0As labeled in the HTML tool
Indentation Padding
indent_size
Description
The number of 'inchar' values to comprise a single indentation.Environment
anyType
numberMode
beautifyLexer
anyDefault
4As labeled in the HTML tool
Indent Size
jsscope
Description
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.Environment
anyType
stringMode
beautifyLexer
scriptAccepted Values
- html
- generates HTML output with escaped angle braces and ampersands for embedding as code, which is handy in code producing tools
- none
- prevents use of this option
- report
- generates HTML output that renders in web browsers
Default
noneAs labeled in the HTML tool
JavaScript Scope Identification
language
Description
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.Environment
anyType
stringMode
anyLexer
anyDefault
autoAs labeled in the HTML tool
Language
language_default
Description
The fallback option if option 'lang' is set to 'auto' and a language cannot be detected.Environment
anyType
stringMode
anyLexer
anyDefault
textAs labeled in the HTML tool
Language Auto-Detection Default
language_name
Description
The formatted proper name of the code sample's language for use in reports read by people.Environment
anyType
stringMode
anyLexer
anyDefault
JavaScriptAs labeled in the HTML tool
Formatted Name of the Code's Language
lexer
Description
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.Environment
anyType
stringMode
anyLexer
anyAccepted Values
- auto
- The value 'auto' imposes language and lexer auto-detection, which ignores deliberately specified language values.
- markup
- parses languages like XML and HTML
- script
- parses languages with a C style syntax, such as JavaScript
- style
- parses CSS like languages
Default
autoAs labeled in the HTML tool
Parsing Lexer
list_options
Description
A Node.js only option that writes current option settings to the console.Environment
nodeType
booleanMode
anyLexer
anyDefault
falseAs labeled in the HTML tool
Options List
method_chain
Description
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.Environment
anyType
numberMode
beautifyLexer
scriptDefault
3As labeled in the HTML tool
Method Chains
minify_wrap
Description
Whether minified script should wrap after a specified character width. This option requires a value from option 'wrap'.Environment
anyType
booleanMode
minifyLexer
scriptDefault
falseAs labeled in the HTML tool
Minification Wrapping
mode
Description
The operation to be performed.Environment
anyType
stringMode
anyLexer
anyAccepted Values
- beautify
- beautifies code and returns a string
- diff
- returns either command line list of differences or an HTML report
- minify
- minifies code and returns a string
- parse
- using option 'parseFormat' returns an object with shallow arrays, a multidimensional array, or an HTML report
Default
diffAs labeled in the HTML tool
Mode
never_flatten
Description
If destructured lists in script should never be flattend.Environment
anyType
booleanMode
beautifyLexer
scriptDefault
falseAs labeled in the HTML tool
Never Flatten Destructured Lists
new_line
Description
Insert an empty line at the end of output.Environment
anyType
booleanMode
anyLexer
anyDefault
falseAs labeled in the HTML tool
New Line at End of Code
no_case_indent
Description
If a case statement should receive the same indentation as the containing switch block.Environment
anyType
booleanMode
beautifyLexer
scriptDefault
falseAs labeled in the HTML tool
Case Indentation
no_lead_zero
Description
Whether leading 0s in CSS values immediately preceeding a decimal should be removed or prevented.Environment
anyType
booleanMode
anyLexer
styleDefault
falseAs labeled in the HTML tool
Leading 0s
node_error
Description
A Node.js only option if parse errors should be written to the console.Environment
nodeType
booleanMode
anyLexer
anyDefault
falseAs labeled in the HTML tool
Write Parse Errors in Node
object_sort
Description
Sorts markup attributes and properties by key name in script and style.Environment
anyType
booleanMode
beautifyLexer
anyDefault
falseAs labeled in the HTML tool
Object/Attribute Sort
output
Description
A file path for which to write output. If this option is not specified output will be printed to the shell.Environment
nodeType
stringMode
anyLexer
anyDefault
As labeled in the HTML tool
Output Location
parse_format
Description
Determines the output format for 'parse' mode.Environment
anyType
stringMode
parseLexer
anyAccepted Values
- htmltable
- generates the 'table' type output for the DOM but escapes the HTML tags for rendering as HTML code in a HTML tool
- parallel
- returns an object containing series of parallel arrays
- sequential
- returns an array where each index is a child object containing the parsed token and all descriptive data
- table
- generates a colorful grid of output for either the dom or command line interface
Default
parallelAs labeled in the HTML tool
Parse Format
parse_space
Description
Whether whitespace tokens should be included in markup parse output.Environment
anyType
booleanMode
parseLexer
markupDefault
falseAs labeled in the HTML tool
Retain White Space Tokens in Parse Output
preserve
Description
The maximum number of consecutive empty lines to retain.Environment
anyType
numberMode
beautifyLexer
anyDefault
0As labeled in the HTML tool
Preserve Consecutive New Lines
preserve_text
Description
If text in the provided markup code should be preserved exactly as provided. This option eliminates beautification and wrapping of text content.Environment
anyType
booleanMode
anyLexer
markupDefault
falseAs labeled in the HTML tool
Preserve Markup Text White Space
quote
Description
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.Environment
anyType
booleanMode
diffLexer
anyDefault
falseAs labeled in the HTML tool
Normalize Quotes
quote_convert
Description
If the quotes of script strings or markup attributes should be converted to single quotes or double quotes.Environment
anyType
stringMode
anyLexer
anyAccepted Values
- double
- Converts single quotes to double quotes
- none
- Ignores this option
- single
- Converts double quotes to single quotes
Default
noneAs labeled in the HTML tool
Indent Size
read_method
Description
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.Environment
nodeType
stringMode
anyLexer
anyAccepted Values
- auto
- changes to value subdirectory, file, or screen depending on source resolution
- directory
- process all files in the specified directory only
- file
- reads a file and outputs to a file. file requires option 'output'
- screen
- reads from screen and outputs to screen
- subdirectory
- process all files in a directory and its subdirectories
Default
autoAs labeled in the HTML tool
Read Method
selector_list
Description
If comma separated CSS selectors should present on a single line of code.Environment
anyType
booleanMode
beautifyLexer
styleDefault
falseAs labeled in the HTML tool
Indent Size
semicolon
Description
If true and mode is 'diff' and lang is 'javascript' all semicolon characters that immediately preceed any white space containing a new line character will be removed so as to elimate some differences from the code comparison.Environment
anyType
booleanMode
diffLexer
scriptDefault
falseAs labeled in the HTML tool
Indent Size
source
Description
The source code or location for interpretation. This option is required for all modes.Environment
anyType
stringMode
anyLexer
anyDefault
As labeled in the HTML tool
Source Sample
source_label
Description
This allows for a descriptive label of the source file code for the diff HTML output.Environment
anyType
stringMode
diffLexer
anyDefault
Source SampleAs labeled in the HTML tool
Label for Source Sample
space
Description
Inserts a space following the function keyword for anonymous functions.Environment
anyType
booleanMode
beautifyLexer
scriptDefault
trueAs labeled in the HTML tool
Function Space
space_close
Description
Markup self-closing tags end will end with ' />' instead of '/>'.Environment
anyType
booleanMode
beautifyLexer
markupDefault
falseAs labeled in the HTML tool
Close Markup Self-Closing Tags with a Space
start
Description
The parse table index to start working from. This is internally used for code samples that require switching between different libraries.Environment
anyType
numberMode
anyLexer
anyDefault
0As labeled in the HTML tool
Start Index
styleguide
Description
Provides a collection of option presets to easily conform to popular JavaScript style guides.Environment
anyType
stringMode
beautifyLexer
scriptAccepted Values
- airbnb
- https://github.com/airbnb/javascript
- crockford
- http://jslint.com/
- google
- https://google.github.io/styleguide/jsguide.html
- jquery
- https://contribute.jquery.org/style-guide/js/
- jslint
- http://jslint.com/
- mediawiki
- https://www.mediawiki.org/wiki/Manual:Coding_conventions/JavaScript
- mrdoob
- https://github.com/mrdoob/three.js/wiki/Mr.doob's-Code-Style%E2%84%A2
- none
- Ignores this option
- standard
- https://standardjs.com/
- yandex
- https://github.com/ymaps/codestyle/blob/master/javascript.md
Default
noneAs labeled in the HTML tool
Script Styleguide
summary_only
Description
Node only option to output only number of differences.Environment
nodeType
booleanMode
diffLexer
anyDefault
falseAs labeled in the HTML tool
Output Diff Only Without A Summary
tag_merge
Description
Allows immediately adjacement start and end markup tags of the same name to be combined into a single self-closing tag.Environment
anyType
booleanMode
anyLexer
markupDefault
falseAs labeled in the HTML tool
Merge Adjacent Start and End tags
tag_sort
Description
Sort child items of each respective markup parent element.Environment
anyType
booleanMode
anyLexer
markupDefault
falseAs labeled in the HTML tool
Sort Markup Child Items
ternary_line
Description
If ternary operators in JavaScript ? and : should remain on the same line.Environment
anyType
booleanMode
beautifyLexer
scriptDefault
falseAs labeled in the HTML tool
Keep Ternary Statements On One Line
unformatted
Description
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.Environment
anyType
booleanMode
anyLexer
markupDefault
falseAs labeled in the HTML tool
Markup Tag Preservation
variable_list
Description
If consecutive JavaScript variables should be merged into a comma separated list or if variables in a list should be separated.Environment
anyType
stringMode
anyLexer
scriptAccepted Values
- each
- Ensurce each reference is a single declaration statement.
- list
- Ensure consecutive declarations are a comma separated list.
- none
- Ignores this option.
Default
noneAs labeled in the HTML tool
Variable Declaration Lists
version
Description
A Node.js only option to write the version information to the console.Environment
nodeType
booleanMode
anyLexer
anyDefault
falseAs labeled in the HTML tool
Version
vertical
Description
If lists of assignments and properties should be vertically aligned. This option is not used with the markup lexer.Environment
anyType
booleanMode
beautifyLexer
anyDefault
falseAs labeled in the HTML tool
Vertical Alignment
wrap
Description
Character width limit before applying word wrap. A 0 value disables this option. A negative value concatenates script strings.Environment
anyType
numberMode
anyLexer
anyDefault
0As labeled in the HTML tool
Wrap
+ brace_line
Description
If true an empty line will be inserted after opening curly braces and before closing curly braces.Environment
anyType
booleanMode
beautifyLexer
scriptDefault
falseAs labeled in the HTML tool
Brace Lines
brace_padding
Description
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.Environment
anyType
booleanMode
beautifyLexer
scriptDefault
falseAs labeled in the HTML tool
Brace Padding
brace_style
Description
Emulates JSBeautify's brace_style option using existing Pretty Diff options.Environment
anyType
stringMode
beautifyLexer
scriptAccepted Values
- collapse
- Sets options.format_object to 'indent' and options.neverflatten to true.
- collapse-preserve-inline
- Sets options.bracepadding to true and options.format_object to 'inline'.
- expand
- Sets options.braces to true, options.format_object to 'indent', and options.neverflatten to true.
- none
- Ignores this option
Default
noneAs labeled in the HTML tool
Brace Style
braces
Description
Determines if opening curly braces will exist on the same line as their condition or be forced onto a new line.Environment
anyType
booleanMode
beautifyLexer
scriptDefault
falseAs labeled in the HTML tool
Style of Indent
color
Description
The color scheme of the reports.Environment
anyType
stringMode
anyLexer
anyAccepted Values
- canvas
- A light brown color scheme
- shadow
- A black and ashen color scheme
- white
- A white and pale grey color scheme
Default
whiteAs labeled in the HTML tool
Color
complete_document
Description
Allows a preference for generating a complete HTML document instead of only generating content.Environment
anyType
booleanMode
anyLexer
markupDefault
falseAs labeled in the HTML tool
Generate A Complete HTML File
compressed_css
Description
If CSS should be beautified in a style where the properties and values are minifed for faster reading of selectors.Environment
anyType
booleanMode
beautifyLexer
styleDefault
falseAs labeled in the HTML tool
Compressed CSS
conditional
Description
If true then conditional comments used by Internet Explorer are preserved at minification of markup.Environment
anyType
booleanMode
minifyLexer
markupDefault
falseAs labeled in the HTML tool
IE Comments (HTML Only)
content
Description
This will normalize all string content to 'text' so as to eliminate some differences from the output.Environment
anyType
booleanMode
diffLexer
anyDefault
falseAs labeled in the HTML tool
Ignore Content
correct
Description
Automatically correct some sloppiness in code.Environment
anyType
booleanMode
anyLexer
anyDefault
falseAs labeled in the HTML tool
Fix Sloppy Code
crlf
Description
If line termination should be Windows (CRLF) format. Unix (LF) format is the default.Environment
anyType
booleanMode
anyLexer
anyDefault
falseAs labeled in the HTML tool
Line Termination
css_insert_lines
Description
Inserts new line characters between every CSS code block.Environment
anyType
booleanMode
beautifyLexer
styleDefault
falseAs labeled in the HTML tool
Insert Empty Lines
diff
Description
The code sample to be compared to 'source' option. This is required if mode is 'diff'.Environment
anyType
stringMode
diffLexer
anyDefault
As labeled in the HTML tool
Code to Compare
diff_context
Description
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.Environment
anyType
numberMode
diffLexer
anyDefault
-1As labeled in the HTML tool
Context Size
diff_format
Description
The format of the output. The command line output format is text, similar to Unix 'diff'.Environment
anyType
stringMode
diffLexer
anyAccepted Values
- html
- An HTML format for embedding in web pages, or as a complete web page if document_complete is true.
- json
- A JSON format.
- text
- Formatted similar to the Unix 'diff' command line utility.
Default
textAs labeled in the HTML tool
Diff Format
diff_label
Description
This allows for a descriptive label for the diff file code of the diff HTML output.Environment
anyType
stringMode
diffLexer
anyDefault
New SampleAs labeled in the HTML tool
Label for Diff Sample
diff_rendered_html
Description
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.Environment
anyType
booleanMode
diffLexer
markupDefault
falseAs labeled in the HTML tool
Compare Rendered HTML
diff_space_ignore
Description
If white space only differences should be ignored by the diff tool.Environment
anyType
booleanMode
diffLexer
anyDefault
falseAs labeled in the HTML tool
Remove White Space
diff_view
Description
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.Environment
anyType
stringMode
diffLexer
anyAccepted Values
- inline
- A single column where insertions and deletions are vertically adjacent.
- sidebyside
- Two column comparison of changes.
Default
sidebysideAs labeled in the HTML tool
Diff View Type
else_line
Description
If else_line is true then the keyword 'else' is forced onto a new line.Environment
anyType
booleanMode
beautifyLexer
scriptDefault
falseAs labeled in the HTML tool
Else On New Line
end_comma
Description
If there should be a trailing comma in arrays and objects. Value "multiline" only applies to modes beautify and diff.Environment
anyType
stringMode
beautifyLexer
scriptAccepted Values
- always
- Always ensure there is a tailing comma
- never
- Remove trailing commas
- none
- Ignore this option
Default
neverAs labeled in the HTML tool
Trailing Comma
end_quietly
Description
A node only option to determine if terminal summary data should be logged to the console.Environment
nodeType
stringMode
anyLexer
anyAccepted Values
- default
- Default minimal summary
- log
- Verbose logging
- quiet
- No extraneous logging
Default
defaultAs labeled in the HTML tool
Log Summary to Console
force_attribute
Description
If all markup attributes should be indented each onto their own line.Environment
anyType
booleanMode
beautifyLexer
markupDefault
falseAs labeled in the HTML tool
Force Indentation of All Attributes
force_indent
Description
Will force indentation upon all content and tags without regard for the creation of new text nodes.Environment
anyType
booleanMode
beautifyLexer
markupDefault
falseAs labeled in the HTML tool
Force Indentation of All Content
format_array
Description
Determines if all array indexes should be indented, never indented, or left to the default.Environment
anyType
stringMode
beautifyLexer
scriptAccepted Values
- default
- Default formatting
- indent
- Always indent each index of an array
- inline
- Ensure all array indexes appear on a single line
Default
defaultAs labeled in the HTML tool
Formatting Arrays
format_object
Description
Determines if all object keys should be indented, never indented, or left to the default.Environment
anyType
stringMode
beautifyLexer
scriptAccepted Values
- default
- Default formatting
- indent
- Always indent each key/value pair
- inline
- Ensure all key/value pairs appear on the same single line
Default
defaultAs labeled in the HTML tool
Formatting Objects
function_name
Description
If a space should follow a JavaScript function name.Environment
anyType
booleanMode
beautifyLexer
scriptDefault
falseAs labeled in the HTML tool
Space After Function Name
help
Description
A node only option to print documentation to the console. The value determines where to wrap text.Environment
nodeType
numberMode
anyLexer
anyDefault
80As labeled in the HTML tool
Help Wrapping Limit
indent_char
Description
The string characters to comprise a single indentation. Any string combination is accepted.Environment
anyType
stringMode
beautifyLexer
anyDefault
As labeled in the HTML tool
Indentation Characters
indent_level
Description
How much indentation padding should be applied to beautification? This option is internally used for code that requires switching between libraries.Environment
anyType
numberMode
beautifyLexer
anyDefault
0As labeled in the HTML tool
Indentation Padding
indent_size
Description
The number of 'inchar' values to comprise a single indentation.Environment
anyType
numberMode
beautifyLexer
anyDefault
4As labeled in the HTML tool
Indent Size
jsscope
Description
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.Environment
anyType
stringMode
beautifyLexer
scriptAccepted Values
- html
- generates HTML output with escaped angle braces and ampersands for embedding as code, which is handy in code producing tools
- none
- prevents use of this option
- report
- generates HTML output that renders in web browsers
Default
noneAs labeled in the HTML tool
JavaScript Scope Identification
language
Description
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.Environment
anyType
stringMode
anyLexer
anyDefault
autoAs labeled in the HTML tool
Language
language_default
Description
The fallback option if option 'lang' is set to 'auto' and a language cannot be detected.Environment
anyType
stringMode
anyLexer
anyDefault
textAs labeled in the HTML tool
Language Auto-Detection Default
language_name
Description
The formatted proper name of the code sample's language for use in reports read by people.Environment
anyType
stringMode
anyLexer
anyDefault
JavaScriptAs labeled in the HTML tool
Formatted Name of the Code's Language
lexer
Description
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.Environment
anyType
stringMode
anyLexer
anyAccepted Values
- auto
- The value 'auto' imposes language and lexer auto-detection, which ignores deliberately specified language values.
- markup
- parses languages like XML and HTML
- script
- parses languages with a C style syntax, such as JavaScript
- style
- parses CSS like languages
Default
autoAs labeled in the HTML tool
Parsing Lexer
list_options
Description
A Node.js only option that writes current option settings to the console.Environment
nodeType
booleanMode
anyLexer
anyDefault
falseAs labeled in the HTML tool
Options List
method_chain
Description
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.Environment
anyType
numberMode
beautifyLexer
scriptDefault
3As labeled in the HTML tool
Method Chains
minify_wrap
Description
Whether minified script should wrap after a specified character width. This option requires a value from option 'wrap'.Environment
anyType
booleanMode
minifyLexer
scriptDefault
falseAs labeled in the HTML tool
Minification Wrapping
mode
Description
The operation to be performed.Environment
anyType
stringMode
anyLexer
anyAccepted Values
- beautify
- beautifies code and returns a string
- diff
- returns either command line list of differences or an HTML report
- minify
- minifies code and returns a string
- parse
- using option 'parseFormat' returns an object with shallow arrays, a multidimensional array, or an HTML report
Default
diffAs labeled in the HTML tool
Mode
never_flatten
Description
If destructured lists in script should never be flattend.Environment
anyType
booleanMode
beautifyLexer
scriptDefault
falseAs labeled in the HTML tool
Never Flatten Destructured Lists
new_line
Description
Insert an empty line at the end of output.Environment
anyType
booleanMode
anyLexer
anyDefault
falseAs labeled in the HTML tool
New Line at End of Code
no_case_indent
Description
If a case statement should receive the same indentation as the containing switch block.Environment
anyType
booleanMode
beautifyLexer
scriptDefault
falseAs labeled in the HTML tool
Case Indentation
no_lead_zero
Description
Whether leading 0s in CSS values immediately preceeding a decimal should be removed or prevented.Environment
anyType
booleanMode
anyLexer
styleDefault
falseAs labeled in the HTML tool
Leading 0s
node_error
Description
A Node.js only option if parse errors should be written to the console.Environment
nodeType
booleanMode
anyLexer
anyDefault
falseAs labeled in the HTML tool
Write Parse Errors in Node
object_sort
Description
Sorts markup attributes and properties by key name in script and style.Environment
anyType
booleanMode
beautifyLexer
anyDefault
falseAs labeled in the HTML tool
Object/Attribute Sort
output
Description
A file path for which to write output. If this option is not specified output will be printed to the shell.Environment
nodeType
stringMode
anyLexer
anyDefault
As labeled in the HTML tool
Output Location
parse_format
Description
Determines the output format for 'parse' mode.Environment
anyType
stringMode
parseLexer
anyAccepted Values
- htmltable
- generates the 'table' type output for the DOM but escapes the HTML tags for rendering as HTML code in a HTML tool
- parallel
- returns an object containing series of parallel arrays
- sequential
- returns an array where each index is a child object containing the parsed token and all descriptive data
- table
- generates a colorful grid of output for either the dom or command line interface
Default
parallelAs labeled in the HTML tool
Parse Format
parse_space
Description
Whether whitespace tokens should be included in markup parse output.Environment
anyType
booleanMode
parseLexer
markupDefault
falseAs labeled in the HTML tool
Retain White Space Tokens in Parse Output
preserve
Description
The maximum number of consecutive empty lines to retain.Environment
anyType
numberMode
beautifyLexer
anyDefault
0As labeled in the HTML tool
Preserve Consecutive New Lines
preserve_text
Description
If text in the provided markup code should be preserved exactly as provided. This option eliminates beautification and wrapping of text content.Environment
anyType
booleanMode
anyLexer
markupDefault
falseAs labeled in the HTML tool
Preserve Markup Text White Space
quote
Description
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.Environment
anyType
booleanMode
diffLexer
anyDefault
falseAs labeled in the HTML tool
Normalize Quotes
quote_convert
Description
If the quotes of script strings or markup attributes should be converted to single quotes or double quotes.Environment
anyType
stringMode
anyLexer
anyAccepted Values
- double
- Converts single quotes to double quotes
- none
- Ignores this option
- single
- Converts double quotes to single quotes
Default
noneAs labeled in the HTML tool
Indent Size
read_method
Description
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.Environment
nodeType
stringMode
anyLexer
anyAccepted Values
- auto
- changes to value subdirectory, file, or screen depending on source resolution
- directory
- process all files in the specified directory only
- file
- reads a file and outputs to a file. file requires option 'output'
- screen
- reads from screen and outputs to screen
- subdirectory
- process all files in a directory and its subdirectories
Default
autoAs labeled in the HTML tool
Read Method
selector_list
Description
If comma separated CSS selectors should present on a single line of code.Environment
anyType
booleanMode
beautifyLexer
styleDefault
falseAs labeled in the HTML tool
Indent Size
semicolon
Description
If true and mode is 'diff' and lang is 'javascript' all semicolon characters that immediately preceed any white space containing a new line character will be removed so as to elimate some differences from the code comparison.Environment
anyType
booleanMode
diffLexer
scriptDefault
falseAs labeled in the HTML tool
Indent Size
source
Description
The source code or location for interpretation. This option is required for all modes.Environment
anyType
stringMode
anyLexer
anyDefault
As labeled in the HTML tool
Source Sample
source_label
Description
This allows for a descriptive label of the source file code for the diff HTML output.Environment
anyType
stringMode
diffLexer
anyDefault
Source SampleAs labeled in the HTML tool
Label for Source Sample
space
Description
Inserts a space following the function keyword for anonymous functions.Environment
anyType
booleanMode
beautifyLexer
scriptDefault
trueAs labeled in the HTML tool
Function Space
space_close
Description
Markup self-closing tags end will end with ' />' instead of '/>'.Environment
anyType
booleanMode
beautifyLexer
markupDefault
falseAs labeled in the HTML tool
Close Markup Self-Closing Tags with a Space
styleguide
Description
Provides a collection of option presets to easily conform to popular JavaScript style guides.Environment
anyType
stringMode
beautifyLexer
scriptAccepted Values
- airbnb
- https://github.com/airbnb/javascript
- crockford
- http://jslint.com/
- google
- https://google.github.io/styleguide/jsguide.html
- jquery
- https://contribute.jquery.org/style-guide/js/
- jslint
- http://jslint.com/
- mediawiki
- https://www.mediawiki.org/wiki/Manual:Coding_conventions/JavaScript
- mrdoob
- https://github.com/mrdoob/three.js/wiki/Mr.doob's-Code-Style%E2%84%A2
- none
- Ignores this option
- standard
- https://standardjs.com/
- yandex
- https://github.com/ymaps/codestyle/blob/master/javascript.md
Default
noneAs labeled in the HTML tool
Script Styleguide
summary_only
Description
Node only option to output only number of differences.Environment
nodeType
booleanMode
diffLexer
anyDefault
falseAs labeled in the HTML tool
Output Diff Only Without A Summary
tag_merge
Description
Allows immediately adjacement start and end markup tags of the same name to be combined into a single self-closing tag.Environment
anyType
booleanMode
anyLexer
markupDefault
falseAs labeled in the HTML tool
Merge Adjacent Start and End tags
tag_sort
Description
Sort child items of each respective markup parent element.Environment
anyType
booleanMode
anyLexer
markupDefault
falseAs labeled in the HTML tool
Sort Markup Child Items
ternary_line
Description
If ternary operators in JavaScript ? and : should remain on the same line.Environment
anyType
booleanMode
beautifyLexer
scriptDefault
falseAs labeled in the HTML tool
Keep Ternary Statements On One Line
unformatted
Description
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.Environment
anyType
booleanMode
anyLexer
markupDefault
falseAs labeled in the HTML tool
Markup Tag Preservation
variable_list
Description
If consecutive JavaScript variables should be merged into a comma separated list or if variables in a list should be separated.Environment
anyType
stringMode
anyLexer
scriptAccepted Values
- each
- Ensurce each reference is a single declaration statement.
- list
- Ensure consecutive declarations are a comma separated list.
- none
- Ignores this option.
Default
noneAs labeled in the HTML tool
Variable Declaration Lists
version
Description
A Node.js only option to write the version information to the console.Environment
nodeType
booleanMode
anyLexer
anyDefault
falseAs labeled in the HTML tool
Version
vertical
Description
If lists of assignments and properties should be vertically aligned. This option is not used with the markup lexer.Environment
anyType
booleanMode
beautifyLexer
anyDefault
falseAs labeled in the HTML tool
Vertical Alignment
wrap
Description
Character width limit before applying word wrap. A 0 value disables this option. A negative value concatenates script strings.Environment
anyType
numberMode
anyLexer
anyDefault
0As labeled in the HTML tool
Wrap
@@ -373,6 +373,6 @@
-
+