|
|
|
@ -8,12 +8,21 @@ export function solveTextLinks(text){
|
|
|
|
|
}
|
|
|
|
|
return `${space}<a href="${hyperlink}" target="_blank">${url}</a>`;
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
export function parseMessage(msg){
|
|
|
|
|
return solveTextLinks(
|
|
|
|
|
msg.replace(/>.*\n/gm, '').trim()
|
|
|
|
|
.replace(/</g, '<')
|
|
|
|
|
.replace(/>/g, '>')
|
|
|
|
|
export function solveMarkdownLinks(text){
|
|
|
|
|
return (text || '').replace(
|
|
|
|
|
/\[([\w\s\d/\\._+-]+)]\(((?:\/|https?:\/\/)[\w\d/.?=#_+-]+)\)/gi,
|
|
|
|
|
(match, text, url)=>{
|
|
|
|
|
return `<a href="${url}" target="_blank">${text}</a>`;
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
export function fixHtml(text){
|
|
|
|
|
return text.replace(/>.*\n/gm, '').trim()
|
|
|
|
|
.replace(/</g, '<')
|
|
|
|
|
.replace(/>/g, '>');
|
|
|
|
|
}
|
|
|
|
|
export function parseMessage(text){
|
|
|
|
|
return solveMarkdownLinks(solveTextLinks(fixHtml(text)));
|
|
|
|
|
}
|