From 9233537e172ffce6d44a09454b7c75369a846bbf Mon Sep 17 00:00:00 2001 From: Anwin Sharon <87226858+darkdeathoriginal@users.noreply.github.com> Date: Fri, 5 Jul 2024 02:08:15 +0530 Subject: [PATCH] refactor: Update MarkdownV2Parser to handle multi-line code blocks (#693) --- gramjs/extensions/markdownv2.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gramjs/extensions/markdownv2.ts b/gramjs/extensions/markdownv2.ts index bf394f3d..106db26e 100644 --- a/gramjs/extensions/markdownv2.ts +++ b/gramjs/extensions/markdownv2.ts @@ -16,7 +16,7 @@ export class MarkdownV2Parser { message = message.replace(/-(.*?)-/g, "$1"); // pre - message = message.replace(/```(.*?)```/g, "
$1"); + message = message.replace(/```([\s\S]*?)```/g, "
$1"); // code message = message.replace(/`(.*?)`/g, "
$1
");
@@ -35,6 +35,8 @@ export class MarkdownV2Parser {
/!\[([^\]]+)\]\(tg:\/\/emoji\?id=(\d+)\)/g,
'