IndentX is a forgiving indentation plugin for Sublime Text inspired by Indent Xml, aimed primarily at preserving attribute ordering and working with invalid content.
Supported content types:
Note: IndentX: Convert JSON to YAML should be considered alpha.
The Indent command will format both XML and JSON like content (content guess based on the first character <
for XML) and can be accessed using the following keyboard short-cuts (think angle brackets: control
/command
+ k
+ <
):
control
+ k
+ ,
command
+ k
+ ,
control
+ k
+ ,
XML before indenting:
XML after indenting:
The Indent & format JSON will try and indent and convert JavaScript-like objects to JSON (e.g. wrapping attributes in "
and converting '
strings to "
). It can be accessed using the following keyboard short-cuts (think curly braces: control
/command
+ k
+ {
):
control
+ k
+ [
command
+ k
+ [
control
+ k
+ [
JSON before and after formatting:
Note: If starting with a JavaScript object and you want to maintain the JavaScipt object format, use the Indent command instead.
The Convert JSON to YAML command will try to convert a JSON document into YAML. As this feature is still very new, my personal experience with YAML is limited, this feature should be considered very alpha. Please submit any issues you may have.
JSON before and YAML after converting:
The Unindent command removes comments and whitespace to format content into one line.
Launches a browser window with the recommended issue structure.
IndentX uses regular expressions (probably more than it should) to identify tokens to:
This technique has the following benefits:
Install using Package Control.
There is a known issue when upgrading from previous versions of IndentX where sub modules aren't reloaded. The work-around for this is to restart Sublime Text.
A solution to this issue should be available soon.
Please report any issues with this plugin with the following sample structure in the body:
Issue with command: {command name}
Sample input:
```
// provide sample here
```
Expected result:
```
// provide expected result here
```
Alternatively, the IndentX: Report issue command will launch a browser with this content pre-filled.