diff --git a/src/formatting/formatters/v2-xml-formatter.ts b/src/formatting/formatters/v2-xml-formatter.ts index c67b0c9..bed5f8a 100644 --- a/src/formatting/formatters/v2-xml-formatter.ts +++ b/src/formatting/formatters/v2-xml-formatter.ts @@ -169,7 +169,7 @@ export class V2XmlFormatter implements XmlFormatter { indentLevel--; // if the end tag immediately follows a line break, just add an indentation - // if the end tag immediately follows another end tag, add a line break and indent + // if the end tag immediately follows another end tag or a self-closing tag (issue #185), add a line break and indent // otherwise, this should be treated as a same-line end tag(ex. text) if (pc === "\n") { output += `${this._getIndent(options, indentLevel)}<`; @@ -179,6 +179,10 @@ export class V2XmlFormatter implements XmlFormatter { output += `${options.newLine}${this._getIndent(options, indentLevel)}<`; } + else if (pc === ">" && ppc === "/") { + output += `${this._getIndent(options, indentLevel)}<`; + } + else { output += "<"; }