fix: use markdown syntax for bold
This commit is contained in:
Родитель
28cd79e98a
Коммит
662a8341f0
|
@ -1,6 +1,11 @@
|
|||
export const escapeSlackMessage = (text: string): string => {
|
||||
// Naively attempt to replace bold tags with Slack syntax
|
||||
text = text.replace(/<b>/g, '**').replace(/<\/b>/g, '**');
|
||||
text = text.replace(/<b>/g, '*').replace(/<\/b>/g, '*');
|
||||
// Some stack traces include "*.mm" which is a recognized domain in slack
|
||||
// but we don't want to linkify
|
||||
text = text.replace(/([a-z])\.mm([^a-z]|$)/g, '$1.mm$2');
|
||||
// Escape all magic Slack Characters
|
||||
return text.replace(/\&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
||||
text = text.replace(/\&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
||||
|
||||
return text;
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче