VuePress EcosystemVuePress Ecosystem
  • Theme Guidelines
  • theme-default
  • Hope Theme
  • Plume Theme
  • Reco Theme
  • Feature Plugins
  • Markdown Plugins
  • Search Plugins
  • Blog Plugins
  • PWA Plugins
  • Analytics Plugins
  • SEO Plugins
  • Development Plugins
  • Tool Plugins
  • AI Plugins
  • @vuepress/helper
  • @vuepress/test-utils
  • English
  • 简体中文
GitHub
  • Theme Guidelines
  • theme-default
  • Hope Theme
  • Plume Theme
  • Reco Theme
  • Feature Plugins
  • Markdown Plugins
  • Search Plugins
  • Blog Plugins
  • PWA Plugins
  • Analytics Plugins
  • SEO Plugins
  • Development Plugins
  • Tool Plugins
  • AI Plugins
  • @vuepress/helper
  • @vuepress/test-utils
  • English
  • 简体中文
GitHub
  • append-date
  • markdown-chart
    • markdown-chart
    • Chart.js
    • ECharts
    • Flowchart
    • Markmap
    • Mermaid
    • PlantUML
  • markdown-container
  • markdown-ext
  • markdown-field
  • markdown-file-tree
  • markdown-image
  • markdown-include
  • markdown-hint
  • markdown-math
  • markdown-preview
  • markdown-stylize
  • markdown-tab
  • links-check
  • prismjs
  • revealjs
    • revealjs
    • Slide Demo
    • Reveal.js Themes
  • shiki

links-check

@vuepress/plugin-links-check

This plugin checks for dead links in your markdown files.

This plugin has been integrated into the default theme.

Usage

npm i -D @vuepress/plugin-links-check@next
.vuepress/config.ts
import { linksCheckPlugin } from '@vuepress/plugin-links-check'

export default {
  plugins: [
    linksCheckPlugin({
      // options
    }),
  ],
}

Guide

Link Checking

The plugin checks every markdown link, and warns for the links whose target file does not exist.

Links are checked in both dev server and build. Set build: 'error' to fail the build when dead links are found.

Use exclude to skip the links that are intentionally broken, by string, regular expression or function.

Anchor Checking

Anchors of links are checked as well. A link is broken when its anchor does not exist in the target page, no matter whether the target page is the current page or another page.

The following anchors are recognized:

  • Heading ids, including the custom ids given by {#custom-id}.
  • Ids in raw html, e.g. <div id="foo">.
  • Ids published by other markdown plugins, such as the field ids generated by @vuepress/plugin-markdown-field.

Set anchors: 'same-page' to only check the anchors pointing to the current page, or false to skip anchor checking.

Anchors of a link are not checked when its target page is not rendered by markdown, since the anchors of that page are unknown.

With anchor checking, a link is compared with exclude both as it is written (including the anchor) and as its path without the anchor.

Options

devboolean
Defaulttrue

Whether to check dead links in markdown in dev server.

buildboolean | 'error'
Defaulttrue

Whether to check dead links in markdown during build. If set to 'error', the build will fail when dead links are found.

anchorsboolean | 'same-page'
Defaulttrue

Whether to check anchors of links. Set to 'same-page' to only check the anchors pointing to the current page, or false to skip anchor checking.

See also: Anchor Checking.

exclude(string | RegExp)[] | ((link: string, isDev: boolean) => boolean)

Links to exclude from checking. You can use a list of strings or regular expressions, or a function that returns a boolean.

.vuepress/config.ts
import { linksCheckPlugin } from '@vuepress/plugin-links-check'

export default {
  plugins: [
    linksCheckPlugin({
      exclude: [
        // exclude links by string
        '/exclude-link',
        // exclude links by regex
        /\/exclude-link-regex/,
      ],

      // or exclude links by function
      exclude: (link, isDev) => {
        if (isDev) {
          return link.startsWith('/exclude-link-dev')
        }
        return link.startsWith('/exclude-link-build')
      },
    }),
  ],
}
Edit this page on GitHub
Last Updated: 9/28/26, 8:53 AM
Contributors: Mister-Hope
Prev
markdown-tab
Next
prismjs