mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-28 03:16:16 -04:00
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:
parent
5a8f7cf54e
commit
371a965045
3 changed files with 87 additions and 193 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue