ImportHtml: Reuse the HTML processor

pull/5285/head
Richard Hansen 2021-11-15 03:17:38 -05:00
parent db105e8650
commit afdb01681a
1 changed files with 4 additions and 5 deletions

View File

@ -23,13 +23,12 @@ const rehype = require('rehype');
const minifyWhitespace = require('rehype-minify-whitespace');
const apiLogger = log4js.getLogger('ImportHtml');
const processor = rehype().use(minifyWhitespace, {newlines: false});
exports.setPadHTML = async (pad, html) => {
rehype()
.use(minifyWhitespace, {newlines: false})
.process(html, (err, output) => {
html = String(output);
});
processor.process(html, (err, output) => {
html = String(output);
});
const {window: {document}} = new jsdom.JSDOM(html);