Skip to content

Action — check-vitepress-md

Detects unescaped Vue template interpolations ({{ expr }}) in docs/ markdown files. VitePress compiles every Markdown file as a Vue SFC, so any interpolation left outside a fenced code block or a v-pre wrapper is evaluated at SSR build time and crashes the build with a TypeError when the referenced variable is undefined.

Usage

yaml
steps:
  - uses: actions/checkout@v4

  - uses: KevinDeBenedetti/github-workflows/.github/actions/check-vitepress-md@main

Inputs

None.

Notes

  • Scans every docs/**/*.md file line by line for unescaped {{ ... }} interpolations.
  • Lines inside fenced code blocks (``` or ~~~) are treated as safe and skipped.
  • Lines inside a ::: v-pre block, or any line containing a v-pre attribute (e.g. <code v-pre>, <span v-pre>), are treated as safe and skipped.
  • Fails (exit 1) and prints file:line for each remaining unescaped interpolation, along with fix options.
  • Suggested fixes:
    • Inline code: <code v-pre>$</code>
    • Inline text: <span v-pre></span>
    • Block: ::: v-pre / / :::
  • Dual-mode: in CI / standalone runs with no arguments it discovers all docs/**/*.md; under prek / pre-commit the staged .md files are passed as arguments.