2018-07-05 06:19:38 -04:00
|
|
|
// NB: This function can still return unsafe HTML
|
2018-05-07 03:30:38 -04:00
|
|
|
export const unescapeHTML = (html) => {
|
|
|
|
const wrapper = document.createElement('div');
|
2018-06-06 14:49:53 -04:00
|
|
|
wrapper.innerHTML = html.replace(/<br\s*\/?>/g, '\n').replace(/<\/p><p>/g, '\n\n').replace(/<[^>]*>/g, '');
|
2018-05-07 03:30:38 -04:00
|
|
|
return wrapper.textContent;
|
|
|
|
};
|