From 05577e5f2efa88ff897bb2c7e75a7726f5250c37 Mon Sep 17 00:00:00 2001 From: AhJ Date: Mon, 15 Apr 2024 23:48:01 +0330 Subject: [PATCH] fix markdown escapes --- src/EntityTools.php | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/EntityTools.php b/src/EntityTools.php index 21a1ac6..582f62f 100644 --- a/src/EntityTools.php +++ b/src/EntityTools.php @@ -169,15 +169,6 @@ final class EntityTools $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. * @@ -185,7 +176,7 @@ final class EntityTools */ public static function markdownCodeEscape(string $what): string { - return \str_replace('`', '\\`', $what); + return \str_replace(['`', '\\'], ['\\`', '\\\\'], $what); } /** * Escape string for URL. @@ -194,6 +185,6 @@ final class EntityTools */ public static function markdownUrlEscape(string $what): string { - return \str_replace(')', '\\)', $what); + return \str_replace([')', '\\'], ['\\)', '\\\\'], $what); } }