Fix local images and em dash rendering
Some checks are pending
Build / build (push) Waiting to run

This commit is contained in:
Neeldhara Misra 2026-06-25 05:21:34 +05:30
parent 4b3aa3022e
commit 632543db4d
55 changed files with 432 additions and 117 deletions

View file

@ -0,0 +1,22 @@
const EM_DASH_PATTERN = /---/g;
function visitTextNodes(node) {
if (!node || typeof node !== "object") return;
if (node.type === "text" && typeof node.value === "string") {
node.value = node.value.replace(EM_DASH_PATTERN, "—");
return;
}
if (!Array.isArray(node.children)) return;
for (const child of node.children) {
visitTextNodes(child);
}
}
export default function remarkTypography() {
return (tree) => {
visitTextNodes(tree);
};
}