Skip to content

XML Formatting

Uilque Messias edited this page Feb 8, 2019 · 5 revisions

Format Ugly XML

After opening an XML document, use the Format Document command, use SHIFT + ALT + F (CTRL + SHIFT + I on Linux), or right-click the document and click Format Document. You can also highlight a subset of XML (as long as it is a valid, well-formed XML node) and perform the same actions.

v1.8.0+: You can format any document or selection as XML by using the Format as XML command.

:bulb: Pro Tip
By default, XML namespace attributes are each given their own line in the formatted XML.
Don't like how that looks? Set the xmlTools.splitXmlnsOnFormat setting to false in your user or workspace settings file.

Minify Formatted XML

If you feel the urge to make your XML ugly again, use the XML Tools: Minify XML command.

:bulb: Pro Tip
By default, your XML comments will remain intact when minifying XML.
To get rid of those comments, set the xmlTools.removeCommentsOnMinify setting to true in your user or workspace settings file.

You can’t perform that action at this time.