namespace Spectre.Console
{
///
/// Contains extension methods for .
///
public static class StringExtensions
{
///
/// Escapes text so that it won’t be interpreted as markup.
///
/// The text to escape.
/// A string that is safe to use in markup.
public static string EscapeMarkup(this string text)
{
if (text == null)
{
return string.Empty;
}
return text
.Replace("[", "[[")
.Replace("]", "]]");
}
}
}