linkingTo
uses tcmts.cli.files.linkedName, which uses tcmts.cli.files.fileFormat, which uses node:path
The pages (Markdown files) that link to the file named name.
import type { Codebase } from "#codebase/tcmts/cli/codebase"; import { filesIn, formatOf, linkedName, markdownLinks } from "#codebase/tcmts/cli/files"; export function linkingTo(cb: Codebase, name: string): string[] { const out: string[] = []; for (const [page, rec] of filesIn(cb, "")) { if (page === name || formatOf(rec) !== "md") continue; if (markdownLinks(rec.sourceText).some((l) => !l.code && linkedName(page, l.target)?.name === name)) out.push(page); } return out; }
uses
- tcmts.cli.codebase.Codebase
- tcmts.cli.files.filesIn
- tcmts.cli.files.formatOf
- tcmts.cli.files.linkedName
- tcmts.cli.files.markdownLinks