editor: use rehype-minify-whitespace
use rehype-minify-whitespace Co-authored-by: webzwo0i <webzwo0i@c3d2.de>pull/4542/head
parent
de5e071294
commit
ef2de59587
|
@ -19,22 +19,16 @@ const Changeset = require('ep_etherpad-lite/static/js/Changeset');
|
||||||
const contentcollector = require('ep_etherpad-lite/static/js/contentcollector');
|
const contentcollector = require('ep_etherpad-lite/static/js/contentcollector');
|
||||||
const cheerio = require('cheerio');
|
const cheerio = require('cheerio');
|
||||||
const rehype = require('rehype');
|
const rehype = require('rehype');
|
||||||
const format = require('rehype-format');
|
const minifyWhitespace = require('rehype-minify-whitespace');
|
||||||
|
|
||||||
|
|
||||||
exports.setPadHTML = async (pad, html) => {
|
exports.setPadHTML = async (pad, html) => {
|
||||||
const apiLogger = log4js.getLogger('ImportHtml');
|
const apiLogger = log4js.getLogger('ImportHtml');
|
||||||
|
|
||||||
const opts = {
|
|
||||||
indentInitial: false,
|
|
||||||
indent: -1,
|
|
||||||
};
|
|
||||||
|
|
||||||
rehype()
|
rehype()
|
||||||
.use(format, opts)
|
.use(minifyWhitespace, {newlines: false})
|
||||||
.process(html, (err, output) => {
|
.process(html, (err, output) => {
|
||||||
html = String(output).replace(/(\r\n|\n|\r)/gm, '');
|
html = String(output);
|
||||||
});
|
});
|
||||||
|
|
||||||
const $ = cheerio.load(html);
|
const $ = cheerio.load(html);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue