Skip to content

Commit

Permalink
fix: fix expandable quote
Browse files Browse the repository at this point in the history
  • Loading branch information
adolphnov committed Dec 24, 2024
1 parent 585b56f commit 98f077d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/telegram/utils/md2tgmd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ function inlineCodeHandler(text: string) {
export function addExpandable(text: string, quoteExpandable: boolean): string {
if (!quoteExpandable) {
// replace log data to expandable
text = text.replace(logRegexp, `**$1||`);
// can't replace log data directly, because there may be other quote marks after the log data, tg doesn't allow expandable quote to be continuous quote
text = text.replace(logRegexp, `$1`).replace(/(?:^>[^\n]*(\n|$))+/m, (match, p1) => `**${match.trimEnd()}||${p1}`);
log.debug(`addExpandable:\n${text}`);
return text;
}
Expand Down

0 comments on commit 98f077d

Please sign in to comment.