bump rehype

remove rehype-format and replace it with rehype-minify-whitespace
don't collapse lines that contain newlines and spaces to newlines, but
to a single space
This commit is contained in:
webzwo0i 2020-11-26 00:35:53 +01:00
parent 5a8f7cf54e
commit 371a965045
3 changed files with 87 additions and 193 deletions

View file

@ -19,21 +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')({newlines: false});
exports.setPadHTML = async (pad, html) => {
const apiLogger = log4js.getLogger('ImportHtml');
const opts = {
indentInitial: false,
indent: -1,
};
rehype()
.use(format, opts)
.use(minifyWhitespace)
.process(html, (err, output) => {
html = String(output).replace(/(\r\n|\n|\r)/gm, '');
html = String(output);
});
const $ = cheerio.load(html);