mirror of
https://github.com/glitch-soc/mastodon.git
synced 2024-11-30 03:50:13 -05:00
7 lines
282 B
JavaScript
7 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;
|
|
};
|