~cytrogen/masto-fe

ref: adf075d19f1aaaa1ca017a067be8e1afa991c4d9 masto-fe/app/javascript/flavours/glitch/utils/html.js -rw-r--r-- 232 bytes
adf075d1 — Zoë Bijl [bugfix] Fix linter issues (#85) 6 months ago
                                                                                
1
2
3
4
5
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;
};