Skip to content

Getting Started

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

You will need to have a Starlight website set up. If you don’t have one yet, you can follow the “Getting Started” guide in the Starlight docs to create one.

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

    Terminal window
    npm i starlight-links-validator
  2. Configure the plugin in 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',
    }),
    ],
    })
  3. Run a production build to validate all internal links in your Markdown and MDX files.

    astro build
    ╭─ getting-started.md
    ·
    7 | /guides/setup/
    · ╰── invalid link
    9 | #troubleshooting
    · ╰── invalid hash
    ╭─ ─╮
    · Found 2 invalid links in 1 file. ·
    ╰─ ─╯

The Starlight Links Validator plugin behavior can be tweaked using various configuration options.