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

Indent XML

by alek-sys ALL Trending Top 100

Plugin for Sublime Text editor for reindenting XML and JSON files

Details

  • 2018.04.12.13.41.08
  • github.​com
  • github.​com
  • 7 years ago
  • 2 hours ago
  • 13 years ago

Installs

  • Total 498K
  • Win 257K
  • Mac 172K
  • Linux 70K
May 29 May 28 May 27 May 26 May 25 May 24 May 23 May 22 May 21 May 20 May 19 May 18 May 17 May 16 May 15 May 14 May 13 May 12 May 11 May 10 May 9 May 8 May 7 May 6 May 5 May 4 May 3 May 2 May 1 Apr 30 Apr 29 Apr 28 Apr 27 Apr 26 Apr 25 Apr 24 Apr 23 Apr 22 Apr 21 Apr 20 Apr 19 Apr 18 Apr 17 Apr 16 Apr 15 Apr 14
Windows 39 48 59 66 18 20 45 60 49 57 52 18 19 43 56 48 50 61 19 20 38 44 39 56 37 18 16 35 31 39 46 43 19 16 40 63 63 49 35 18 17 39 55 59 44 59
Mac 29 46 54 34 5 11 30 38 33 56 35 7 12 41 34 47 34 37 6 7 41 37 53 44 30 13 8 28 20 53 47 32 14 9 48 41 35 54 26 7 6 20 24 39 44 39
Linux 3 8 14 11 2 3 13 9 13 15 10 2 3 13 11 15 16 12 0 4 19 9 4 17 19 3 5 6 5 14 11 4 4 3 18 19 15 13 4 6 4 5 7 14 18 12

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)