|
@ -1,3 +1,4 @@ |
|
|
|
|
|
// NB: This function can still return unsafe HTML
|
|
|
export const unescapeHTML = (html) => { |
|
|
export const unescapeHTML = (html) => { |
|
|
const wrapper = document.createElement('div'); |
|
|
const wrapper = document.createElement('div'); |
|
|
wrapper.innerHTML = html.replace(/<br\s*\/?>/g, '\n').replace(/<\/p><p>/g, '\n\n').replace(/<[^>]*>/g, ''); |
|
|
wrapper.innerHTML = html.replace(/<br\s*\/?>/g, '\n').replace(/<\/p><p>/g, '\n\n').replace(/<[^>]*>/g, ''); |
|
|