diff --git a/src/build.js b/src/build.js index 1880a808a5..ccf09fd541 100644 --- a/src/build.js +++ b/src/build.js @@ -114,6 +114,9 @@ async function build({ config, feeds, cache, writeCache = false }) { const redirect = config.redirects[host]; if (redirect) item.link = `https://${redirect}${url.pathname}${url.search}`; } + + // 5. escape html in titles + item.title = escapeHtml(item.title); }); // add to allItems @@ -193,4 +196,13 @@ function readCfg(path) { } return json; -} \ No newline at end of file +} + + +function escapeHtml(html) { + return html.replaceAll('&', '&') + .replaceAll('<', '<') + .replaceAll('>', '>') + .replaceAll('\'', ''') + .replaceAll('"', '"'); +}