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
  • 6 years ago
  • 26 minutes ago
  • 13 years ago

Installs

  • Total 477K
  • Win 246K
  • Mac 164K
  • Linux 67K
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 Jul 2 Jul 1 Jun 30 Jun 29 Jun 28 Jun 27 Jun 26 Jun 25 Jun 24 Jun 23 Jun 22 Jun 21 Jun 20 Jun 19 Jun 18 Jun 17 Jun 16 Jun 15 Jun 14 Jun 13 Jun 12 Jun 11
Windows 50 57 67 65 47 21 21 47 63 58 57 55 13 14 56 62 66 68 56 15 12 48 41 59 62 44 21 20 49 61 68 59 68 22 14 60 71 48 54 47 23 26 60 56 50 73
Mac 39 41 42 47 41 10 7 29 57 36 43 36 5 8 34 48 42 38 42 11 5 29 38 49 44 31 11 13 34 40 56 49 36 7 6 47 45 51 32 31 11 4 36 40 37 43
Linux 15 20 15 10 28 4 3 7 16 15 14 14 6 1 12 11 11 12 10 5 1 11 16 13 12 17 1 3 13 25 19 12 13 2 6 10 22 18 22 13 4 5 6 6 14 16

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)