diff --git a/lib/helpers.js b/lib/helpers.js index fed4908..e71bbe7 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -68,22 +68,10 @@ function objectToAttributes(obj) { }, ""); } -/** - * Checks for `
` tag in a string. - * - * @param {string} content The content - * @return {boolean} `True` if body tag, `False` otherwise. - */ -function hasBodyTag(content) { - const hasBody = /<\s*body(\w|\s|=|"|-)*>/gm; - return hasBody.test(content); -} - module.exports = { isUrl, isAllowedExtension, parseStringToNumbers, generateWidths, objectToAttributes, - hasBodyTag, }; diff --git a/lib/img2picture.js b/lib/img2picture.js index 474c511..845295e 100644 --- a/lib/img2picture.js +++ b/lib/img2picture.js @@ -10,7 +10,6 @@ const { generateWidths, parseStringToNumbers, objectToAttributes, - hasBodyTag, } = require("./helpers.js"); /** @@ -210,7 +209,7 @@ async function generateImage(attrs, options) { */ async function replaceImages(content, options) { const { extensions, fetchRemote } = options; - const $ = cheerio.load(content); + const $ = cheerio.load(content, null, false); let images = $("img") .not("picture img") // Ignore images wrapped in