From af48a672c73d276148f7af87c1e4fe0c3ccd14ec Mon Sep 17 00:00:00 2001 From: webzwo0i Date: Tue, 24 Nov 2020 00:11:46 +0100 Subject: [PATCH] remove newlines only in the context of ordered lists - TODO check unordered --- src/node/utils/ImportHtml.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/node/utils/ImportHtml.js b/src/node/utils/ImportHtml.js index 8cbfdbab9..ee08ede36 100644 --- a/src/node/utils/ImportHtml.js +++ b/src/node/utils/ImportHtml.js @@ -33,7 +33,12 @@ exports.setPadHTML = async (pad, html) => { rehype() .use(format, opts) .process(html, function(err, output){ - html = String(output).replace(/(\r\n|\n|\r)/gm,""); + html = String(output) + .replace(/
    \n/gm,"
      ") + .replace(/<\/ol>\n/gm,"
    ") + .replace(/
  1. \n/gm,"
  2. ") + .replace(/<\/li>\n/gm,"
  3. ") + .replace(/>\n<\/li>/gm,">") }) var $ = cheerio.load(html);