From ef2de5958780b1f42823145d01bebc47bd9dcc2b Mon Sep 17 00:00:00 2001 From: John McLear Date: Sat, 5 Dec 2020 08:14:09 +0000 Subject: [PATCH] editor: use rehype-minify-whitespace use rehype-minify-whitespace Co-authored-by: webzwo0i --- src/node/utils/ImportHtml.js | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/node/utils/ImportHtml.js b/src/node/utils/ImportHtml.js index 9032eda77..2a31fc12e 100644 --- a/src/node/utils/ImportHtml.js +++ b/src/node/utils/ImportHtml.js @@ -19,22 +19,16 @@ const Changeset = require('ep_etherpad-lite/static/js/Changeset'); const contentcollector = require('ep_etherpad-lite/static/js/contentcollector'); const cheerio = require('cheerio'); const rehype = require('rehype'); -const format = require('rehype-format'); - +const minifyWhitespace = require('rehype-minify-whitespace'); exports.setPadHTML = async (pad, html) => { const apiLogger = log4js.getLogger('ImportHtml'); - const opts = { - indentInitial: false, - indent: -1, - }; - rehype() - .use(format, opts) - .process(html, (err, output) => { - html = String(output).replace(/(\r\n|\n|\r)/gm, ''); - }); + .use(minifyWhitespace, {newlines: false}) + .process(html, (err, output) => { + html = String(output); + }); const $ = cheerio.load(html);