Browse Source

Added support for single-line code blocks

tags/docs-0.9
RogueException 9 years ago
parent
commit
2d54504de8
1 changed files with 6 additions and 1 deletions
  1. +6
    -1
      src/Discord.Net/Format.cs

+ 6
- 1
src/Discord.Net/Format.cs View File

@@ -103,7 +103,12 @@ namespace Discord

/// <summary> Returns a markdown-formatted string with strikeout formatting, optionally escaping the contents. </summary>
public static string Code(string text, string language = null, bool escape = true)
=> $"```{language ?? ""}\n{(escape ? Escape(text) : text)}\n```";
{
if (text.Contains("\n"))
return $"```{language ?? ""}\n{(escape ? Escape(text) : text)}\n```";
else
return $"`{(escape ? Escape(text) : text)}`";
}

/// <summary> Returns a markdown-formatted string with multiple formatting, optionally escaping the contents. </summary>
public static string Multiple(string text, bool escape = true,


Loading…
Cancel
Save