From 5f6314984683cd39bbcfadbfdd60410e4d8977fb Mon Sep 17 00:00:00 2001 From: Metropass Date: Fri, 19 Feb 2021 10:00:48 -0500 Subject: [PATCH] Added Space Removal for Paragraphs --- package.json | 1 + src/backend/utils/html/index.js | 3 +++ 2 files changed, 4 insertions(+) diff --git a/package.json b/package.json index 7a13d20785..56d23cdffa 100644 --- a/package.json +++ b/package.json @@ -82,6 +82,7 @@ "body-parser": "1.19.0", "bull": "3.20.1", "bull-board": "1.3.1", + "clean-whitespace": "0.1.2", "connect-redis": "5.1.0", "cors": "2.8.5", "date-fns": "2.17.0", diff --git a/src/backend/utils/html/index.js b/src/backend/utils/html/index.js index 7bf07fe515..44bdd40f5d 100644 --- a/src/backend/utils/html/index.js +++ b/src/backend/utils/html/index.js @@ -4,6 +4,7 @@ const fixIFrameWidth = require('./fix-iframe-width'); const lazyLoad = require('./lazy-load'); const syntaxHighlight = require('./syntax-highlight'); const replaceCodeEntities = require('./replace-entities'); +const emptyParagraph = require('./remove-empty-paragraphs'); const fixEmptyPre = require('./modify-pre'); const toDOM = require('./dom'); @@ -42,6 +43,8 @@ module.exports = function process(html) { lazyLoad(dom); // Replace elements with encoded entities to use characters replaceCodeEntities(dom); + // Removes spaces, tabs and any "clear" characters in a paragraph + emptyParagraph(dom); // Return the resulting HTML return dom.window.document.body.innerHTML;