/// <summary> /// Sanitize input HTML using default settings. /// </summary> /// <param name="baseUri"></param> /// <param name="input">Input HTML. May be <c>null</c>.</param> /// <returns>Sanitized HTML.</returns> public static string Sanitize(string baseUri, string input) { if (input == null) { return null; } var inputReader = new StringReader(input); var resultWriter = new StringWriter(); resultWriter.GetStringBuilder().EnsureCapacity(input.Length + 32); resultWriter.NewLine = "\n"; var sanitizer = new ImgSanitizer(baseUri); sanitizer.Sanitize(inputReader, resultWriter); return resultWriter.ToString(); }
/// <summary> /// Sanitize input HTML using default settings. /// </summary> /// <param name="baseUri"></param> /// <param name="input">Input HTML. May be <c>null</c>.</param> /// <returns>Sanitized HTML.</returns> public static string Sanitize(string baseUri, string input) { if (input == null) { return(null); } var inputReader = new StringReader(input); var resultWriter = new StringWriter(); resultWriter.GetStringBuilder().EnsureCapacity(input.Length + 32); resultWriter.NewLine = "\n"; var sanitizer = new ImgSanitizer(baseUri); sanitizer.Sanitize(inputReader, resultWriter); return(resultWriter.ToString()); }