~cytrogen/masto-fe

ref: 392c07f2bf01743fdbf92abb555a4c558c7f4a31 masto-fe/app/javascript/mastodon/utils/html.js -rw-r--r-- 282 bytes
392c07f2 — Claire Fix `Setting.authorized_fetch` not being properly taken into consideration (#26958) 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;
};