Default to multiline codeblock if a language is specified

This commit is contained in:
RogueException
2015-10-15 03:30:24 -03:00
parent c7eabfd49f
commit 8e44311a54

View File

@@ -104,7 +104,7 @@ 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)
{
if (text.Contains("\n"))
if (language != null || text.Contains("\n"))
return $"```{language ?? ""}\n{(escape ? Escape(text) : text)}\n```";
else
return $"`{(escape ? Escape(text) : text)}`";