mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-05-13 17:26:08 +03:00
style: move ZWSP to a const
This commit is contained in:
parent
2359feca7d
commit
6b9c9007d5
1 changed files with 4 additions and 2 deletions
|
@ -5,6 +5,8 @@ namespace Octobot.Extensions;
|
||||||
|
|
||||||
public static class StringExtensions
|
public static class StringExtensions
|
||||||
{
|
{
|
||||||
|
private const string ZeroWidthSpace = "";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sanitizes a string for use in <see cref="Markdown.BlockCode(string)" /> by inserting zero-width spaces in between
|
/// Sanitizes a string for use in <see cref="Markdown.BlockCode(string)" /> by inserting zero-width spaces in between
|
||||||
/// symbols used to format the string with block code.
|
/// symbols used to format the string with block code.
|
||||||
|
@ -13,7 +15,7 @@ public static class StringExtensions
|
||||||
/// <returns>The sanitized string that can be safely used in <see cref="Markdown.BlockCode(string)" />.</returns>
|
/// <returns>The sanitized string that can be safely used in <see cref="Markdown.BlockCode(string)" />.</returns>
|
||||||
private static string SanitizeForBlockCode(this string s)
|
private static string SanitizeForBlockCode(this string s)
|
||||||
{
|
{
|
||||||
return s.Replace("```", "```");
|
return s.Replace("```", $"{ZeroWidthSpace}`{ZeroWidthSpace}`{ZeroWidthSpace}`{ZeroWidthSpace}");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -25,7 +27,7 @@ public static class StringExtensions
|
||||||
/// <returns>The sanitized string that can be safely used in <see cref="Markdown.BlockCode(string, string)" /> with "diff" as the language.</returns>
|
/// <returns>The sanitized string that can be safely used in <see cref="Markdown.BlockCode(string, string)" /> with "diff" as the language.</returns>
|
||||||
public static string SanitizeForDiffBlock(this string s)
|
public static string SanitizeForDiffBlock(this string s)
|
||||||
{
|
{
|
||||||
return $"{s}";
|
return $"{ZeroWidthSpace}{s}";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue