mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-21 04:45:17 +00:00
Convert HTML entities, codes and tag (#3191)
related to PR [#3092](https://github.com/MichMich/MagicMirror/pull/3092) maybe best way is using `html-to-text` library sample: `"Hello World"` will be transformed to `"Hello World"`
This commit is contained in:
committed by
GitHub
parent
7a1591b2d6
commit
91fd931a58
@@ -8,6 +8,7 @@
|
||||
const stream = require("stream");
|
||||
const FeedMe = require("feedme");
|
||||
const iconv = require("iconv-lite");
|
||||
const { htmlToText } = require("html-to-text");
|
||||
const Log = require("logger");
|
||||
const NodeHelper = require("node_helper");
|
||||
|
||||
@@ -53,6 +54,8 @@ const NewsfeedFetcher = function (url, reloadInterval, encoding, logFeedWarnings
|
||||
if (title && pubdate) {
|
||||
const regex = /(<([^>]+)>)/gi;
|
||||
description = description.toString().replace(regex, "");
|
||||
// Convert HTML entities, codes and tag
|
||||
description = htmlToText(description, { wordwrap: false });
|
||||
|
||||
items.push({
|
||||
title: title,
|
||||
|
Reference in New Issue
Block a user