mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-12-05 03:19:04 +01:00
6 lines
282 B
JavaScript
6 lines
282 B
JavaScript
// NB: This function can still return unsafe HTML
|
|
export const unescapeHTML = (html) => {
|
|
const wrapper = document.createElement('div');
|
|
wrapper.innerHTML = html.replace(/<br\s*\/?>/g, '\n').replace(/<\/p><p>/g, '\n\n').replace(/<[^>]*>/g, '');
|
|
return wrapper.textContent;
|
|
};
|