mirror of
https://github.com/danog/telegram-tt.git
synced 2024-11-27 04:45:08 +01:00
Message Input: Fix markdown parsing inside code and links (#1587)
This commit is contained in:
parent
35b533045c
commit
a4693b7cb9
@ -84,9 +84,18 @@ function parseMarkdown(html: string) {
|
|||||||
parsedHtml = parsedHtml.replace(/[`]{1}([^`\n]+)[`]{1}/g, '<code>$1</code>');
|
parsedHtml = parsedHtml.replace(/[`]{1}([^`\n]+)[`]{1}/g, '<code>$1</code>');
|
||||||
|
|
||||||
// Other simple markdown
|
// Other simple markdown
|
||||||
parsedHtml = parsedHtml.replace(/[*]{2}([^*\n]+)[*]{2}/g, '<b>$1</b>');
|
parsedHtml = parsedHtml.replace(
|
||||||
parsedHtml = parsedHtml.replace(/[_]{2}([^*\n]+)[_]{2}/g, '<i>$1</i>');
|
/(^|\s)(?!<code[^<]*|<\/)[*]{2}([^*\n]+)[*]{2}(?![^<]*<\/code>)(\s|$)/g,
|
||||||
parsedHtml = parsedHtml.replace(/[~]{2}([^~\n]+)[~]{2}/g, '<s>$1</s>');
|
'$1<b>$2</b>$3',
|
||||||
|
);
|
||||||
|
parsedHtml = parsedHtml.replace(
|
||||||
|
/(^|\s)(?!<code[^<]*|<\/)[_]{2}([^_\n]+)[_]{2}(?![^<]*<\/code>)(\s|$)/g,
|
||||||
|
'$1<i>$2</i>$3',
|
||||||
|
);
|
||||||
|
parsedHtml = parsedHtml.replace(
|
||||||
|
/(^|\s)(?!<code[^<]*|<\/)[~]{2}([^~\n]+)[~]{2}(?![^<]*<\/code>)(\s|$)/g,
|
||||||
|
'$1<s>$2</s>$3',
|
||||||
|
);
|
||||||
|
|
||||||
return parsedHtml;
|
return parsedHtml;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user