Skip to content

Commit

Permalink
Update build.js
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinfiol committed Mar 21, 2024
1 parent b0907e4 commit 75ac38d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/build.js
Expand Up @@ -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
Expand Down Expand Up @@ -193,4 +196,13 @@ function readCfg(path) {
}

return json;
}
}


function escapeHtml(html) {
return html.replaceAll('&', '&')
.replaceAll('<', '&lt;')
.replaceAll('>', '&gt;')
.replaceAll('\'', '&apos;')
.replaceAll('"', '&quot;');
}

0 comments on commit 75ac38d

Please sign in to comment.