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