~cytrogen/masto-fe

ref: 873838ebfea14401f50c23cbf6dd0228e0866bfa masto-fe/app/javascript/flavours/glitch/utils/html.js -rw-r--r-- 232 bytes
873838eb — julia [feature] Always show content warning: use existing glitch feature (#1) 1 year, 4 months ago
                                                                                
1
2
3
4
5
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;
};