2023-11-15 05:40:52 -06:00
|
|
|
// NB: This function can still return unsafe HTML
|
2018-05-10 06:04:55 -05:00
|
|
|
export const unescapeHTML = (html) => {
|
|
|
|
const wrapper = document.createElement('div');
|
2018-06-15 14:31:08 -05:00
|
|
|
wrapper.innerHTML = html.replace(/<br\s*\/?>/g, '\n').replace(/<\/p><p>/g, '\n\n').replace(/<[^>]*>/g, '');
|
2018-05-10 06:04:55 -05:00
|
|
|
return wrapper.textContent;
|
|
|
|
};
|