Update CSS Pipeline #4

Merged
wonderfulfrog merged 7 commits from feat/update-css-pipeline into main 2025-05-30 11:16:38 -07:00
3 changed files with 8 additions and 1208 deletions
Showing only changes of commit 7c621fedce - Show all commits

View file

@ -1,29 +1,15 @@
import { JSDOM } from "jsdom";
// From coryd.dev
// https://www.coryd.dev/posts/2025/generating-absolute-urls-in-my-rss-feeds/
const convertRelativeLinks = (htmlContent, url) => {
if (!htmlContent || !url) return htmlContent;
const dom = new JSDOM(htmlContent);
const document = dom.window.document;
const baseUrl = url.replace(/\/$/, "");
document.querySelectorAll("a[href]").forEach((link) => {
let href = link.getAttribute("href");
if (href.startsWith("#")) {
link.remove();
return;
}
if (!href.startsWith("http://") && !href.startsWith("https://"))
link.setAttribute(
"href",
`${url.replace(/\/$/, "")}/${href.replace(/^\/+/, "")}`,
);
});
return document.body.innerHTML;
return htmlContent.replace(
/(href|src)=(['"])(?![a-z][a-z0-9+.-]*:|\/\/)([^'"]+)\2/gi,
(_, attr, quote, relUrl) => {
const clean = relUrl.replace(/^\//, "");
return `${attr}=${quote}${baseUrl}/${clean}${quote}`;
},
);
};
export default {

1185
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -23,7 +23,6 @@
"dayjs": "^1.11.10",
"dotenv": "^16.4.5",
"html-minifier-terser": "^7.2.0",
"jsdom": "^26.0.0",
"markdown-it": "^14.0.0",
"markdown-it-abbr": "^2.0.0",
"markdown-it-anchor": "^8.6.7",