Browse Source

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.
tags/2.0
Christopher Felegy 6 years ago
parent
commit
f005af37b4
1 changed files with 4 additions and 0 deletions
  1. +4
    -0
      src/Discord.Net.Core/Format.cs

+ 4
- 0
src/Discord.Net.Core/Format.cs View File

@@ -14,6 +14,10 @@ namespace Discord
public static string Underline(string text) => $"__{text}__";
/// <summary> Returns a markdown-formatted string with strikethrough formatting. </summary>
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>
public static string Code(string text, string language = null)


Loading…
Cancel
Save