~cytrogen/masto-fe

ref: 14bb6bb29a49f151c8a6c379e5d2ddb663f8e923 masto-fe/app/javascript/mastodon/utils/html.js -rw-r--r-- 282 bytes
14bb6bb2 — Claire Fix `null` signUp URL in various places (#25190) 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;
};