resolvePath
rel resolved against the directory dir, both relative to the repository (docs, ../examples/README.md
is examples/README.md).
export function resolvePath(dir: string, rel: string): string { const out: string[] = []; for (const s of `${dir}/${rel}`.split("/")) { if (s === "..") out.pop(); else if (s && s !== ".") out.push(s); } return out.join("/"); }