~cytrogen/masto-fe

ref: 60792ec75346a80c5912ee3f918acc8d8a88deb2 masto-fe/app/javascript/mastodon/utils/html.js -rw-r--r-- 282 bytes
60792ec7 — prplecake [feature] Add logout button to sidebar (#48) 10 months 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;
};