From afdb01681a53735a3387fa09ec42b29210aef8c9 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Mon, 15 Nov 2021 03:17:38 -0500 Subject: [PATCH] ImportHtml: Reuse the HTML processor --- src/node/utils/ImportHtml.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/node/utils/ImportHtml.js b/src/node/utils/ImportHtml.js index fc6a95bde..cc3ecb09b 100644 --- a/src/node/utils/ImportHtml.js +++ b/src/node/utils/ImportHtml.js @@ -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);