     
     open class func wrapTextInHTML(text: String) -> String {
         
-        let strippedString = text.replacingOccurrences(of: "<[^>]+>", with: "", options: .regularExpression, range: nil)
+        let whiteSpaceEscaped = text.trimmingCharacters(in: .whitespaces)
+        
+        let strippedString = whiteSpaceEscaped.replacingOccurrences(of: "<[^>]+>", with: "", options: .regularExpression, range: nil)
         
         let detector =  try! NSDataDetector(types: NSTextCheckingResult.CheckingType.link.rawValue)
         

            }
        }
        
        newStr = newStr.replacingOccurrences(of: "\n", with: "<br>")
        return newStr
    }
}

        
        return output
    }
        
    open class func attributedTextForString(text: String) -> NSAttributedString {
        
        guard let htmlStringData = text.data(using: String.Encoding.utf8) else {
