Merged changed from dev branch

This commit is contained in:
RogueException
2016-09-22 21:31:48 -03:00
19 changed files with 167 additions and 64 deletions

View File

@@ -2,6 +2,9 @@
{
public static class Format
{
// Characters which need escaping
private static string[] SensitiveCharacters = { "*", "_", "~", "`", "\\" };
/// <summary> Returns a markdown-formatted string with bold formatting. </summary>
public static string Bold(string text) => $"**{text}**";
/// <summary> Returns a markdown-formatted string with italics formatting. </summary>
@@ -19,5 +22,15 @@
else
return $"`{text}`";
}
/// <summary> Sanitizes the string, safely escaping any Markdown sequences. </summary>
public static string Sanitize(string text)
{
foreach (string unsafeChar in SensitiveCharacters)
{
text = text.Replace(unsafeChar, $"\\{unsafeChar}");
}
return text;
}
}
}