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

  • 2017.08.09.18.59.29
  • github.​com
  • github.​com
  • 1 week ago
  • 2 hours ago
  • 6 years ago

Installs

  • Total 183K
  • Win 90K
  • OS X 66K
  • Linux 28K
Aug 17 Aug 16 Aug 15 Aug 14 Aug 13 Aug 12 Aug 11 Aug 10 Aug 9 Aug 8 Aug 7 Aug 6 Aug 5 Aug 4 Aug 3 Aug 2 Aug 1 Jul 31 Jul 30 Jul 29 Jul 28 Jul 27 Jul 26 Jul 25 Jul 24 Jul 23 Jul 22 Jul 21 Jul 20 Jul 19 Jul 18 Jul 17 Jul 16 Jul 15 Jul 14 Jul 13 Jul 12 Jul 11 Jul 10 Jul 9 Jul 8 Jul 7 Jul 6 Jul 5 Jul 4 Jul 3
Windows 102 168 118 116 26 47 104 152 156 164 150 30 30 153 161 162 172 122 27 27 115 132 151 160 148 34 35 125 139 147 129 146 25 30 143 158 158 163 151 41 44 141 143 162 149 132
OS X 63 75 79 73 13 19 76 100 96 83 55 20 17 68 84 89 102 68 27 23 77 90 75 86 99 28 28 57 83 86 94 80 11 30 74 108 87 84 77 26 20 70 93 98 75 66
Linux 40 35 38 26 12 8 34 38 36 41 28 3 13 31 48 27 34 35 19 16 27 39 41 30 26 16 5 30 24 31 49 35 8 10 34 43 27 40 37 12 12 37 32 28 38 40

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 guy) 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)