fix markdown escapes

This commit is contained in:
AhJ 2024-04-15 23:48:01 +03:30
parent 1ba3dc574c
commit 05577e5f2e

View File

@ -169,15 +169,6 @@ final class EntityTools
$what $what
); );
} }
/**
* Escape string for markdown codeblock.
*
* @param string $what String to escape
*/
public static function markdownCodeblockEscape(string $what): string
{
return \str_replace('```', '\\```', $what);
}
/** /**
* Escape string for markdown code section. * Escape string for markdown code section.
* *
@ -185,7 +176,7 @@ final class EntityTools
*/ */
public static function markdownCodeEscape(string $what): string public static function markdownCodeEscape(string $what): string
{ {
return \str_replace('`', '\\`', $what); return \str_replace(['`', '\\'], ['\\`', '\\\\'], $what);
} }
/** /**
* Escape string for URL. * Escape string for URL.
@ -194,6 +185,6 @@ final class EntityTools
*/ */
public static function markdownUrlEscape(string $what): string public static function markdownUrlEscape(string $what): string
{ {
return \str_replace(')', '\\)', $what); return \str_replace([')', '\\'], ['\\)', '\\\\'], $what);
} }
} }