editor: use rehype-minify-whitespace

use rehype-minify-whitespace

Co-authored-by: webzwo0i <webzwo0i@c3d2.de>
pull/4542/head
John McLear 2020-12-05 08:14:09 +00:00 committed by GitHub
parent de5e071294
commit ef2de59587
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 11 deletions

View File

@ -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);