mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-24 22:08:08 +01:00
695dcc6ca8
Port 1142f4c79e
to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
9 lines
305 B
TypeScript
9 lines
305 B
TypeScript
// NB: This function can still return unsafe HTML
|
|
export const unescapeHTML = (html: string) => {
|
|
const wrapper = document.createElement('div');
|
|
wrapper.innerHTML = html
|
|
.replace(/<br\s*\/?>/g, '\n')
|
|
.replace(/<\/p><p>/g, '\n\n')
|
|
.replace(/<[^>]*>/g, '');
|
|
return wrapper.textContent;
|
|
};
|