mirror of
https://github.com/danog/telegram-entities.git
synced 2024-12-02 09:37:48 +01:00
fix markdown escapes
This commit is contained in:
parent
1ba3dc574c
commit
05577e5f2e
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user