~cytrogen/masto-fe

ref: f89f3a85662ce1f4e6f130748ded22821e4a7acd masto-fe/app/javascript/flavours/glitch/utils/html.js -rw-r--r-- 232 bytes
f89f3a85 — Claire Fix glitch-soc's thread line styling (#2214) 2 years 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;
};