Refactor routing in App component to enhance navigation and improve error handling by integrating dynamic routes and updating the NotFound route.

This commit is contained in:
becarta
2025-05-23 12:43:00 +02:00
parent f40db0f5c9
commit a544759a3b
11127 changed files with 1647032 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
import { visit } from "unist-util-visit";
function rehypeImages() {
return () => function(tree, file) {
const imageOccurrenceMap = /* @__PURE__ */ new Map();
visit(tree, (node) => {
if (node.type !== "element") return;
if (node.tagName !== "img") return;
if (node.properties?.src) {
node.properties.src = decodeURI(node.properties.src);
if (file.data.imagePaths?.has(node.properties.src)) {
const { ...props } = node.properties;
const index = imageOccurrenceMap.get(node.properties.src) || 0;
imageOccurrenceMap.set(node.properties.src, index + 1);
node.properties["__ASTRO_IMAGE_"] = JSON.stringify({ ...props, index });
Object.keys(props).forEach((prop) => {
delete node.properties[prop];
});
}
}
});
};
}
export {
rehypeImages
};