Unibeautify
  • Install
  • Docs
  • Assistant
  • Playground
  • GitHub

›U

A

  • Align Assignments
  • Arrow Parens

B

  • Brace Style
  • Break Chained Methods

C

  • Comma First

E

  • End With Comma
  • End With Newline
  • End With Semicolon

F

  • Force Indentation

I

  • Identifier Case
  • Indent Chained Methods
  • Indent Comments
  • Indent Inner Html
  • Indent Scripts
  • Indent Size
  • Indent Style

J

  • JSLint Happy
  • JSX Brackets

K

  • Keep Array Indentation
  • Keyword Case

M

  • Max Preserve Newlines
  • Multiline Ternary

N

  • Newline Before Tags
  • Newline Between Rules
  • No Leading Zero

O

  • Object Curly Spacing

P

  • Pragma Insert
  • Pragma Require
  • Preserve Newlines

Q

  • Quotes

R

  • Remove Trailing Whitespace

S

  • Selector Separator Newline
  • Space After Anon Function
  • Space Before Conditional
  • Space In Empty Paren
  • Space In Paren

U

  • Unescape Strings
  • Unformatted

W

  • Wrap Attributes
  • Wrap Attributes Indent Size
  • Wrap Line Length
  • Wrap Prose
Edit

Unformatted

Config Key: unformatted

Description: List of tags (defaults to inline) that should not be reformatted

Available since version: 0.7.0 (Current: npm)

Type: array of strings

Default: ["a","abbr","area","audio","b","bdi","bdo","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","keygen","label","map","mark","math","meter","noscript","object","output","progress","q","ruby","s","samp","select","small","span","strong","sub","sup","svg","template","textarea","time","u","var","video","wbr","text","acronym","address","big","dt","strike","tt","pre","h1","h2","h3","h4","h5","h6"]

Support

Edit Beautifiers

Languages: HTML, Handlebars, Liquid, Mustache, XML

Beautifiers: JS-Beautify

Comparison Table

LanguageJS-Beautify
HTML✅
Handlebars✅
Liquid✅
Mustache✅
XML✅

Examples

Invisible characters are shown with the following symbols:

Carriage Return = ␍; Line Feed = ␊; Tab = ⇥; Whitespace = ·.

Edit HTML Example

🚧 Original Code

<div>␊
<h1>Unformatted</h1>␊
<div>␊
<span>Un<span>formatted</span></span>␊
</div>␊
<span><span>For</span><span>mat</span><span>ted</span></span>␊
<div><div>For</div><div>mat</div><div>ted</div></div>␊
</div>␊

🔧 []

Using JS-Beautify beautifier:

<div>␊
··<h1>Unformatted</h1>␊
··<div>␊
····<span>Un<span>formatted</span></span>␊
··</div>␊
··<span><span>For</span><span>mat</span><span>ted</span></span>␊
··<div>␊
····<div>For</div>␊
····<div>mat</div>␊
····<div>ted</div>␊
··</div>␊
</div>

How to configure A .unibeautify.json file would look like the following:

{
  "HTML": {
    "indent_size": 2,
    "indent_char": " ",
    "unformatted": [],
    "beautifiers": [
      "JS-Beautify"
    ]
  }
}

Difference from original

Index: 
===================================================================
---     Original
+++     Beautified
@@ -1,8 +1,12 @@
 <div>␊
-<h1>Unformatted</h1>␊
-<div>␊
-<span>Un<span>formatted</span></span>␊
-</div>␊
-<span><span>For</span><span>mat</span><span>ted</span></span>␊
-<div><div>For</div><div>mat</div><div>ted</div></div>␊
-</div>␊
+··<h1>Unformatted</h1>␊
+··<div>␊
+····<span>Un<span>formatted</span></span>␊
+··</div>␊
+··<span><span>For</span><span>mat</span><span>ted</span></span>␊
+··<div>␊
+····<div>For</div>␊
+····<div>mat</div>␊
+····<div>ted</div>␊
+··</div>␊
+</div>
\ No newline at end of file

🔧 ["a","abbr","area","audio","b","bdi","bdo","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","keygen","label","map","mark","math","meter","noscript","object","output","progress","q","ruby","s","samp","select","small","span","strong","sub","sup","svg","template","textarea","time","u","var","video","wbr","text","acronym","address","big","dt","strike","tt","pre","h1","h2","h3","h4","h5","h6"]

Using JS-Beautify beautifier:

<div>␊
··<h1>Unformatted</h1>␊
··<div>␊
····<span>Un<span>formatted</span></span>␊
··</div>␊
··<span><span>For</span><span>mat</span><span>ted</span></span>␊
··<div>␊
····<div>For</div>␊
····<div>mat</div>␊
····<div>ted</div>␊
··</div>␊
</div>

How to configure A .unibeautify.json file would look like the following:

{
  "HTML": {
    "indent_size": 2,
    "indent_char": " ",
    "unformatted": [
      "a",
      "abbr",
      "area",
      "audio",
      "b",
      "bdi",
      "bdo",
      "br",
      "button",
      "canvas",
      "cite",
      "code",
      "data",
      "datalist",
      "del",
      "dfn",
      "em",
      "embed",
      "i",
      "iframe",
      "img",
      "input",
      "ins",
      "kbd",
      "keygen",
      "label",
      "map",
      "mark",
      "math",
      "meter",
      "noscript",
      "object",
      "output",
      "progress",
      "q",
      "ruby",
      "s",
      "samp",
      "select",
      "small",
      "span",
      "strong",
      "sub",
      "sup",
      "svg",
      "template",
      "textarea",
      "time",
      "u",
      "var",
      "video",
      "wbr",
      "text",
      "acronym",
      "address",
      "big",
      "dt",
      "strike",
      "tt",
      "pre",
      "h1",
      "h2",
      "h3",
      "h4",
      "h5",
      "h6"
    ],
    "beautifiers": [
      "JS-Beautify"
    ]
  }
}

Difference from original

Index: a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,strike,tt,pre,h1,h2,h3,h4,h5,h6
===================================================================
--- a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,strike,tt,pre,h1,h2,h3,h4,h5,h6 Original
+++ a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,strike,tt,pre,h1,h2,h3,h4,h5,h6 Beautified
@@ -1,8 +1,12 @@
 <div>␊
-<h1>Unformatted</h1>␊
-<div>␊
-<span>Un<span>formatted</span></span>␊
-</div>␊
-<span><span>For</span><span>mat</span><span>ted</span></span>␊
-<div><div>For</div><div>mat</div><div>ted</div></div>␊
-</div>␊
+··<h1>Unformatted</h1>␊
+··<div>␊
+····<span>Un<span>formatted</span></span>␊
+··</div>␊
+··<span><span>For</span><span>mat</span><span>ted</span></span>␊
+··<div>␊
+····<div>For</div>␊
+····<div>mat</div>␊
+····<div>ted</div>␊
+··</div>␊
+</div>
\ No newline at end of file

Add Handlebars Example

No example found. Please submit a Pull Request!

Add Liquid Example

No example found. Please submit a Pull Request!

Add Mustache Example

No example found. Please submit a Pull Request!

Edit XML Example

🚧 Original Code

<div>␊
<h1>Unformatted</h1>␊
<div>␊
<span>Un<span>formatted</span></span>␊
</div>␊
<span><span>For</span><span>mat</span><span>ted</span></span>␊
<div><div>For</div><div>mat</div><div>ted</div></div>␊
</div>␊

🔧 []

Using JS-Beautify beautifier:

<div>␊
··<h1>Unformatted</h1>␊
··<div>␊
····<span>Un<span>formatted</span></span>␊
··</div>␊
··<span><span>For</span><span>mat</span><span>ted</span></span>␊
··<div>␊
····<div>For</div>␊
····<div>mat</div>␊
····<div>ted</div>␊
··</div>␊
</div>

How to configure A .unibeautify.json file would look like the following:

{
  "XML": {
    "indent_size": 2,
    "indent_char": " ",
    "unformatted": [],
    "beautifiers": [
      "JS-Beautify"
    ]
  }
}

Difference from original

Index: 
===================================================================
---     Original
+++     Beautified
@@ -1,8 +1,12 @@
 <div>␊
-<h1>Unformatted</h1>␊
-<div>␊
-<span>Un<span>formatted</span></span>␊
-</div>␊
-<span><span>For</span><span>mat</span><span>ted</span></span>␊
-<div><div>For</div><div>mat</div><div>ted</div></div>␊
-</div>␊
+··<h1>Unformatted</h1>␊
+··<div>␊
+····<span>Un<span>formatted</span></span>␊
+··</div>␊
+··<span><span>For</span><span>mat</span><span>ted</span></span>␊
+··<div>␊
+····<div>For</div>␊
+····<div>mat</div>␊
+····<div>ted</div>␊
+··</div>␊
+</div>
\ No newline at end of file

🔧 ["a","abbr","area","audio","b","bdi","bdo","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","keygen","label","map","mark","math","meter","noscript","object","output","progress","q","ruby","s","samp","select","small","span","strong","sub","sup","svg","template","textarea","time","u","var","video","wbr","text","acronym","address","big","dt","strike","tt","pre","h1","h2","h3","h4","h5","h6"]

Using JS-Beautify beautifier:

<div>␊
··<h1>Unformatted</h1>␊
··<div>␊
····<span>Un<span>formatted</span></span>␊
··</div>␊
··<span><span>For</span><span>mat</span><span>ted</span></span>␊
··<div>␊
····<div>For</div>␊
····<div>mat</div>␊
····<div>ted</div>␊
··</div>␊
</div>

How to configure A .unibeautify.json file would look like the following:

{
  "XML": {
    "indent_size": 2,
    "indent_char": " ",
    "unformatted": [
      "a",
      "abbr",
      "area",
      "audio",
      "b",
      "bdi",
      "bdo",
      "br",
      "button",
      "canvas",
      "cite",
      "code",
      "data",
      "datalist",
      "del",
      "dfn",
      "em",
      "embed",
      "i",
      "iframe",
      "img",
      "input",
      "ins",
      "kbd",
      "keygen",
      "label",
      "map",
      "mark",
      "math",
      "meter",
      "noscript",
      "object",
      "output",
      "progress",
      "q",
      "ruby",
      "s",
      "samp",
      "select",
      "small",
      "span",
      "strong",
      "sub",
      "sup",
      "svg",
      "template",
      "textarea",
      "time",
      "u",
      "var",
      "video",
      "wbr",
      "text",
      "acronym",
      "address",
      "big",
      "dt",
      "strike",
      "tt",
      "pre",
      "h1",
      "h2",
      "h3",
      "h4",
      "h5",
      "h6"
    ],
    "beautifiers": [
      "JS-Beautify"
    ]
  }
}

Difference from original

Index: a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,strike,tt,pre,h1,h2,h3,h4,h5,h6
===================================================================
--- a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,strike,tt,pre,h1,h2,h3,h4,h5,h6 Original
+++ a,abbr,area,audio,b,bdi,bdo,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,keygen,label,map,mark,math,meter,noscript,object,output,progress,q,ruby,s,samp,select,small,span,strong,sub,sup,svg,template,textarea,time,u,var,video,wbr,text,acronym,address,big,dt,strike,tt,pre,h1,h2,h3,h4,h5,h6 Beautified
@@ -1,8 +1,12 @@
 <div>␊
-<h1>Unformatted</h1>␊
-<div>␊
-<span>Un<span>formatted</span></span>␊
-</div>␊
-<span><span>For</span><span>mat</span><span>ted</span></span>␊
-<div><div>For</div><div>mat</div><div>ted</div></div>␊
-</div>␊
+··<h1>Unformatted</h1>␊
+··<div>␊
+····<span>Un<span>formatted</span></span>␊
+··</div>␊
+··<span><span>For</span><span>mat</span><span>ted</span></span>␊
+··<div>␊
+····<div>For</div>␊
+····<div>mat</div>␊
+····<div>ted</div>␊
+··</div>␊
+</div>
\ No newline at end of file

← Unescape StringsWrap Attributes →
  • Support
  • Examples
Unibeautify
Docs
Getting StartedCLIConfigurationOptions
Community
User ShowcaseStack Overflow@Unibeautify on TwitterFollow Unibeautify on Twitter
More
GitHubStar Unibeautify on GitHubCode coverage of UnibeautifyCode coverage of Unibeautify
© 2020 Glavin Wiechert
Credits