relativeLink
How a page links to a file of the codebase: the relative path from the one name to the other (with its format).
export function relativeLink(fromName: string, toName: string, format: string): string { const from = fromName.split(".").slice(0, -1); const to = toName.split("."); const leaf = to.pop()!; let common = 0; while (common < from.length && common < to.length && from[common] === to[common]) common++; return [...from.slice(common).map(() => ".."), ...to.slice(common), `${leaf}.${format}`].join("/"); }