feature: add Format.Url, Format.EscapeUrl

Format.Url formats a URL into a markdown `[]()` masked URL.

Format.EscapeUrl formats a URL into a Discord `<>` escaped URL.
This commit is contained in:
Christopher Felegy
2018-11-27 17:31:47 -05:00
parent a64ab6025b
commit f005af37b4

View File

@@ -14,6 +14,10 @@ namespace Discord
public static string Underline(string text) => $"__{text}__"; public static string Underline(string text) => $"__{text}__";
/// <summary> Returns a markdown-formatted string with strikethrough formatting. </summary> /// <summary> Returns a markdown-formatted string with strikethrough formatting. </summary>
public static string Strikethrough(string text) => $"~~{text}~~"; public static string Strikethrough(string text) => $"~~{text}~~";
/// <summary> Returns a markdown-formatted URL. Only works in <see cref="EmbedBuilder"/> descriptions and fields. </summary>
public static string Url(string text, string url) => $"[{text}]({url})";
/// <summary> Escapes a URL so that a preview is not generated. </summary>
public static string EscapeUrl(string url) => $"<{url}>";
/// <summary> Returns a markdown-formatted string with codeblock formatting. </summary> /// <summary> Returns a markdown-formatted string with codeblock formatting. </summary>
public static string Code(string text, string language = null) public static string Code(string text, string language = null)