diff --git a/src/Discord.Net.Core/Format.cs b/src/Discord.Net.Core/Format.cs
index 55161b21d..0ab70f89c 100644
--- a/src/Discord.Net.Core/Format.cs
+++ b/src/Discord.Net.Core/Format.cs
@@ -44,7 +44,7 @@ namespace Discord
/// Formats a string as a quote.
///
/// The text to format.
- /// Gets the formatted quote text. // TODO: better xmldoc
+ /// Gets the formatted quote text.
public static string Quote(string text)
{
// do not modify null or whitespace text
@@ -77,5 +77,19 @@ namespace Discord
return result.ToString();
}
+
+ ///
+ /// Formats a string as a block quote.
+ ///
+ /// The text to format.
+ /// Gets the formatted block quote text.
+ public static string BlockQuote(string text)
+ {
+ // do not modify null or whitespace
+ if (string.IsNullOrWhiteSpace(text))
+ return text;
+
+ return $">>> {text}";
+ }
}
}
diff --git a/test/Discord.Net.Tests.Unit/FormatTests.cs b/test/Discord.Net.Tests.Unit/FormatTests.cs
index c3737af8e..2a5adbaae 100644
--- a/test/Discord.Net.Tests.Unit/FormatTests.cs
+++ b/test/Discord.Net.Tests.Unit/FormatTests.cs
@@ -46,5 +46,18 @@ namespace Discord
{
Assert.Equal(expected, Format.Quote(input));
}
+ [Theory]
+ [InlineData(null, null)]
+ [InlineData("", "")]
+ [InlineData("\n", "\n")]
+ [InlineData("foo\n\nbar", ">>> foo\n\nbar")]
+ [InlineData("input", ">>> input")] // single line
+ // should work with CR or CRLF
+ [InlineData("inb4\ngreentext", ">>> inb4\ngreentext")]
+ [InlineData("inb4\r\ngreentext", ">>> inb4\r\ngreentext")]
+ public void BlockQuote(string input, string expected)
+ {
+ Assert.Equal(expected, Format.BlockQuote(input));
+ }
}
}