ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Indent XML

by alek-sys ST2/ST3 Top 100

Plugin for Sublime Text editor for reindenting XML and JSON files

Details

  • 2018.04.12.13.41.08
  • github.​com
  • github.​com
  • 9 months ago
  • 5 hours ago
  • 7 years ago

Installs

  • Total 258K
  • Win 130K
  • OS X 90K
  • Linux 38K
Jan 17 Jan 16 Jan 15 Jan 14 Jan 13 Jan 12 Jan 11 Jan 10 Jan 9 Jan 8 Jan 7 Jan 6 Jan 5 Jan 4 Jan 3 Jan 2 Jan 1 Dec 31 Dec 30 Dec 29 Dec 28 Dec 27 Dec 26 Dec 25 Dec 24 Dec 23 Dec 22 Dec 21 Dec 20 Dec 19 Dec 18 Dec 17 Dec 16 Dec 15 Dec 14 Dec 13 Dec 12 Dec 11 Dec 10 Dec 9 Dec 8 Dec 7 Dec 6 Dec 5 Dec 4 Dec 3
Windows 104 151 157 181 18 0 5 181 171 156 132 26 33 143 135 110 34 44 27 41 117 109 115 54 62 25 24 120 136 183 172 151 26 26 138 150 180 171 158 41 46 151 169 153 171 185
OS X 46 74 99 68 12 0 3 104 92 91 66 28 23 77 65 51 17 20 17 21 49 48 49 18 28 21 18 54 80 83 79 80 32 21 66 88 73 93 84 19 22 73 86 102 88 63
Linux 27 55 38 47 4 0 0 29 37 20 37 15 10 39 18 24 6 7 8 6 17 19 28 11 16 6 6 24 33 33 34 38 12 7 28 33 44 32 30 11 9 51 28 31 39 35

Readme

Source
raw.​githubusercontent.​com

SublimeText Indent plugin

What is the goal of Indent plugin? Short answer is converting this XML

<root><node attr="1" attr2="4"><node /></node></root>

to this:

<root>
    <node attr="1" attr2="4">
        <node/>
    </node>
</root>

Looks good? It also can convert this JSON

{ "root": [ { "field": "val1", "field2": "val2" }, { "arr": [1, 3, "three"] }] }

to this

{
    "root": [
        {
            "field": "val1",
            "field2": "val2"
        },
        {
            "arr": [
                1,
                3,
                "three"
            ]
        }
    ]
}

Want more? It can indent only selected text - including multiple selections and even mixed XML / JSON selections. It is smart enough to recognize XML or JSON even if you are editing plain text. Indent plugin won’t mess up your keyboard shortcuts because it uses “chord” command Ctrl+K, Ctrl+F (this mean hold Ctrl, press K then press F, release Ctrl) and also available in “Selection” menu.

Supported Sublime Text versions

Indent plugin supports both Sublime Text 2 and Sublime Text 3

Installation

Just use Package Control and search for “indent xml” plugin

Usage

Click on Tools->Command Pallette… (or Ctrl+shift+P if you're a keyboard person) and then chose “Indent XML”

Settings

Currently this plugin performs patching of xml.dom.minidom.CDataSection class in order to fix CDATA indenting in toprettyxml function. This can be disabled in indent_xml.Sublime-settings file by setting disable_patch_minidom to true.

Feedback & Support

Available on Github

Contribution

…is always welcome! Same place - Github

License

This software is distributed under MIT license (see License.txt for details)