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

Indent XML

by alek-sys ALL Top 100

Plugin for Sublime Text editor for reindenting XML and JSON files

Details

  • 2018.04.12.13.41.08
  • github.​com
  • github.​com
  • 3 years ago
  • 47 minutes ago
  • 9 years ago

Installs

  • Total 356K
  • Win 182K
  • Mac 121K
  • Linux 53K
Mar 8 Mar 7 Mar 6 Mar 5 Mar 4 Mar 3 Mar 2 Mar 1 Feb 28 Feb 27 Feb 26 Feb 25 Feb 24 Feb 23 Feb 22 Feb 21 Feb 20 Feb 19 Feb 18 Feb 17 Feb 16 Feb 15 Feb 14 Feb 13 Feb 12 Feb 11 Feb 10 Feb 9 Feb 8 Feb 7 Feb 6 Feb 5 Feb 4 Feb 3 Feb 2 Feb 1 Jan 31 Jan 30 Jan 29 Jan 28 Jan 27 Jan 26 Jan 25 Jan 24 Jan 23 Jan 22
Windows 7 34 41 110 128 137 125 102 37 41 95 107 112 120 93 34 40 83 112 102 94 96 34 37 98 93 115 122 100 49 35 94 137 118 111 108 44 39 97 113 107 97 93 44 44 94
Mac 5 25 20 62 53 63 85 45 26 14 43 63 78 57 65 22 33 52 69 71 48 50 19 19 66 67 55 73 60 19 22 76 73 70 70 54 8 20 57 68 76 66 56 23 13 53
Linux 5 8 14 31 25 26 28 27 9 15 20 32 31 27 24 7 6 18 28 18 17 21 5 10 20 25 28 33 22 11 8 15 23 24 25 26 9 9 26 25 25 28 23 9 7 28

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)