From 61a07adb59c3da3386e323f4df6d9b7412416afa Mon Sep 17 00:00:00 2001 From: Josh Johnson Date: Tue, 12 Jun 2018 21:23:31 -0400 Subject: [PATCH] Prevent Indentation for Inline CDATA Issue: #194 --- src/formatting/formatters/v2-xml-formatter.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/formatting/formatters/v2-xml-formatter.ts b/src/formatting/formatters/v2-xml-formatter.ts index 975a2c0..ab60c13 100644 --- a/src/formatting/formatters/v2-xml-formatter.ts +++ b/src/formatting/formatters/v2-xml-formatter.ts @@ -45,7 +45,14 @@ export class V2XmlFormatter implements XmlFormatter { // entering CData if (location === Location.Text && cc === "<" && nc === "!" && nnc === "[") { - output += `${this._getIndent(options, indentLevel)}<`; + if (pc === ">" && ppc !== "/") { + output += "<"; + } + + else { + output += `${this._getIndent(options, indentLevel)}<`; + } + location = Location.CData; }