describedIndex
The index (docs/README.md) with each row that has nothing beside a page's link (| [CLI](cli.md) | |) saying what
describe says of that page: the index orders the pages, and each page says what it's about.
import { resolvePath } from "#codebase/tcmts/site"; export function describedIndex( index: string, describe: (src: string) => string | undefined, ): string { return index.replace( /^(\| \[[^\]]+\]\(([^)#]+)\) \|)[ \t]*\|?[ \t]*$/gm, (line, row: string, to: string) => { const d = describe(resolvePath("docs", to)); return d === undefined ? line : `${row} ${d.replaceAll("|", "\\|")} |`; }, ); }