Skip to content

Commit

Permalink
refactor: Update MarkdownV2Parser to handle multi-line code blocks (#693
Browse files Browse the repository at this point in the history
)
  • Loading branch information
darkdeathoriginal committed Jul 4, 2024
1 parent 5a0f45b commit 9233537
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion gramjs/extensions/markdownv2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class MarkdownV2Parser {
message = message.replace(/-(.*?)-/g, "<i>$1</i>");

// pre
message = message.replace(/```(.*?)```/g, "<pre>$1</pre>");
message = message.replace(/```([\s\S]*?)```/g, "<pre>$1</pre>");

// code
message = message.replace(/`(.*?)`/g, "<code>$1</code>");
Expand All @@ -35,6 +35,8 @@ export class MarkdownV2Parser {
/!\[([^\]]+)\]\(tg:\/\/emoji\?id=(\d+)\)/g,
'<tg-emoji emoji-id="$2">$1</tg-emoji>'
);

//
return HTMLParser.parse(message);
}

Expand Down

0 comments on commit 9233537

Please sign in to comment.