From 9483a5793600f00c03787fdb9501a9b9a8fcf474 Mon Sep 17 00:00:00 2001
From: mic
/gi, '\n') // replace
with newline
- .replace(/<\/p\s*>/gi, '\n') // replace
/gi, '') // remove
tag - .replace(/<[^>]*>/g, ' ') // remove any other HTML tags - .replace(/[ \t]+\n/g, '\n') // remove spaces before newline - .replace(/\n{2,}/g, '\n') // compress multiple newlines into one - .replace(/\s+/g, ' ') // normalize spaces inside lines - .trim(); // trim spaces at start and end + .replace(/
/gi, '') + .replace(//gi, '') + .replace(/<\/(div|section|article|li|ul|ol|table|tr|td|th)>/gi, '\n') // newline for block tags + .replace(/<[^>]*>/g, '') // remove all other tags with no extra spaces + .replace(/[ \t]+\n/g, '\n') + .replace(/\n{2,}/g, '\n') + .replace(/[ \t]+/g, ' ') + .trim(); } export function convertNewlinesToBr(text) {