Skip to content

Getting Started

Features

A Starlight plugin to validate internal links in Markdown and MDX files.

  • Validate internal links to other pages
  • Validate internal links to anchors in other pages
  • Validate internal links to anchors in the same page
  • Ignore external links
  • Run only during a production build

Install the plugin

Starlight Links Validator is a Starlight plugin. Install it using your favorite package manager:

Terminal window
npm install starlight-links-validator

Add the plugin

The Starlight Links Validator plugin can be added to your Starlight configuration in the astro.config.mjs file:

astro.config.mjs
import starlight from '@astrojs/starlight'
import { defineConfig } from 'astro/config'
import starlightLinksValidator from 'starlight-links-validator'
export default defineConfig({
integrations: [
starlight({
plugins: [starlightLinksValidator()],
title: 'My Docs',
}),
],
})

Running a production build will now validate all internal links in your Markdown and MDX files. The Starlight Links Validator plugin behavior can be tweaked using various configuration options.