diff --git a/CHANGELOG.md b/CHANGELOG.md index a9a7b915f6..3140c95139 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ _This release is scheduled to be released on 2024-01-01._ ### Updated - Update electron to v27 and update other dependencies as well as github actions +- Update newsfeed: Use `html-to-text` instead of regex for transform description ### Fixed diff --git a/modules/default/newsfeed/newsfeedfetcher.js b/modules/default/newsfeed/newsfeedfetcher.js index 0f1b5d6c6d..0c52e347ce 100644 --- a/modules/default/newsfeed/newsfeedfetcher.js +++ b/modules/default/newsfeed/newsfeedfetcher.js @@ -52,10 +52,15 @@ const NewsfeedFetcher = function (url, reloadInterval, encoding, logFeedWarnings const url = item.url || item.link || ""; if (title && pubdate) { - const regex = /(<([^>]+)>)/gi; - description = description.toString().replace(regex, ""); // Convert HTML entities, codes and tag - description = htmlToText(description, { wordwrap: false }); + description = htmlToText(description, { + wordwrap: false, + selectors: [ + { selector: "a", options: { ignoreHref: true, noAnchorUrl: true } }, + { selector: "br", format: "inlineSurround", options: { prefix: " " } }, + { selector: "img", format: "skip" } + ] + }); items.push({ title: title,