~cytrogen/masto-fe

ref: c310374a2f83a890520ace50e41c1e3d046e15e1 masto-fe/app/javascript/mastodon/utils/html.js -rw-r--r-- 282 bytes
c310374a — Claire Fix clicking on already-opened thread post scrolling to the top of the thread (#27331) 2 years ago
                                                                                
1
2
3
4
5
6
// NB: This function can still return unsafe HTML
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;
};