deps: Bump rehype and rehype-minify-whitespace

This commit is contained in:
Richard Hansen 2022-01-27 00:23:02 -05:00
parent 1e604add99
commit 9db3424403
3 changed files with 169 additions and 140 deletions

View file

@ -19,13 +19,17 @@ const log4js = require('log4js');
const Changeset = require('../../static/js/Changeset');
const contentcollector = require('../../static/js/contentcollector');
const jsdom = require('jsdom');
const rehype = require('rehype');
const minifyWhitespace = require('rehype-minify-whitespace');
const apiLogger = log4js.getLogger('ImportHtml');
const processor = rehype().use(minifyWhitespace, {newlines: false});
let processor;
exports.setPadHTML = async (pad, html) => {
if (processor == null) {
const [{rehype}, {default: minifyWhitespace}] =
await Promise.all([import('rehype'), import('rehype-minify-whitespace')]);
processor = rehype().use(minifyWhitespace, {newlines: false});
}
html = String(await processor.process(html));
const {window: {document}} = new jsdom.JSDOM(html);