alek-sys / sublimetext_indentxml

Plugin for Sublime Text editor for reindenting XML and JSON files
MIT License
534 stars 136 forks source link

Indenting strips whitespace before a tag's text when it should keep the integrity of the text. #82

Open epicstar opened 8 years ago

epicstar commented 8 years ago

Sorry for the title, I can't change it.....

Elements of tags that start with whitespace lose that whitespace after beautifying a previously minified XML.

For example, the second element has a non-breaking whitespace as the first character of the text (see test="action_to_2"):

<content mm:initial="true" mm:status="template" test="action_to_1">Text</content><content mm:initial="true" mm:status="637e8150-7b77-4f83-bda0-2c018ecc030f" test="action_to_2"> text</content>

When I indent the XML (Selection -> Format or CTRL+SHIFT+P -> Indent XML), I get this:

<content mm:initial="true" mm:status="template" test="action_to_1">Text</content>
<content mm:initial="true" mm:status="637e8150-7b77-4f83-bda0-2c018ecc030f" test="action_to_2">text</content>

I would expect it to be this instead:

<content mm:initial="true" mm:status="template" test="action_to_1">Text</content>
<content mm:initial="true" mm:status="637e8150-7b77-4f83-bda0-2c018ecc030f" test="action_to_2"> text</content>

This issue is clear enough right? It's possible that I might have to give you a file for this...