Introduction
A tool for validating links in Markdown files
Setup
Install it.
Scan available URLs, it predicts them from your file-system based routing.
Validate Markdown files and print errors.
The validateFiles
function accepts a list of file paths or file objects containing its path and content.
You can run this script during lint process, or before builds.
tsx
.Configurations
Meta
Specify allowed queries and fragments of a page.
Static Params
Use populate
to populate dynamic routes into static.
Each param object indicates a page, allowed hashes and queries can be specified individually.
Multiple Params
When you have multiple dynamic routes, you need to use an object instead.
External Urls
To validate external urls, enable it.
Relative Urls
To support relative urls, specify a function that generates URL based on file path. This will assign a URL to each Markdown file, so that relative URLs can be resolved correctly.
You can also point to a Markdown file:
It will be resolved into the generated URL of that Markdown file (same as pathToUrl("./another-file.md")
).
Utilities
readFiles
Read files for given glob patterns, and output a list of file objects.
You can use it in conjunction with validateFiles
.
Advanced
pages
By default, it looks for the pages from your file system. You can override the obtained pages by passing an array of urls.
This also allows you to parse available pages from non-Next.js routing.