validate-mdx-links
v1.1.0
Published
Wraps `next-validate-link` with heuristics for false positives. Handles relative links, with and without `.mdx` extension, and treats `page.mdx` (Next.js App Router) as an index file.
Downloads
39
Readme
validate-mdx-links
Wraps next-validate-link with heuristics for false positives.
Handles relative links, with and without .mdx extension, and treats page.mdx (Next.js App Router) as an index file.
Install
pnpm add -D validate-mdx-linksCLI
validate-mdx-links --files "content/**/*.mdx" --verbose--cwddefaults toprocess.cwd()--verboseprints every scanned route- exits
1on broken links,0otherwise
Relative links lose .mdx in MDX or JSX. The CLI checks ./foo, ./foo.mdx, and ../foo/page.mdx before complaining.
API
import { validateMdxLinks, printErrors } from "validate-mdx-links";
const errors = await validateMdxLinks({
cwd: "/path/to/docs",
files: "content/**/*.mdx",
verbose: true,
});You get an array of { file, detected }. Pass it to printErrors or build your own reporter.
