about summary refs log blame commit diff
path: root/app/javascript/flavours/glitch/util/html.js
blob: 5159df9db75bebedbf46da9edd374645f917a4c5 (plain) (tree)
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;
};