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,33 @@
/**
* @typedef {import('nlcst').Paragraph} Paragraph
* @typedef {import('nlcst').Root} Root
*/
import {modifyChildren} from 'unist-util-modify-children'
// Move white space ending a paragraph up, so they are the siblings of
// paragraphs.
export const makeFinalWhiteSpaceSiblings = modifyChildren(
/**
* @type {import('unist-util-modify-children').Modifier<Paragraph | Root>}
*/
function (child, index, parent) {
if ('children' in child) {
const tail = child.children[child.children.length - 1]
if (tail && tail.type === 'WhiteSpaceNode') {
child.children.pop() // Remove `tail`.
parent.children.splice(index + 1, 0, tail)
const previous = child.children[child.children.length - 1]
if (previous && previous.position && child.position) {
child.position.end = previous.position.end
}
// Next, iterate over the current node again.
return index
}
}
}
)