0
0
Fork 0
mirror of https://github.com/lunaisnotaboy/mastodon.git synced 2025-03-21 17:39:31 +00:00
mastodon/app/javascript/flavours/glitch/util/html.js
2018-06-16 15:09:28 +02:00

6 lines
232 B
JavaScript

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;
};