~cytrogen/masto-fe

ref: 450f75b6f7a1c8d39af77abc713363c4ad692f1a masto-fe/app/javascript/mastodon/utils/html.js -rw-r--r-- 282 bytes
450f75b6 — Eugen Rochko [Glitch] Add published date and author to news on the explore screen in web UI 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;
};