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@mainInputs
None.
Notes
- Scans every
docs/**/*.mdfile line by line for unescaped{{ ... }}interpolations. - Lines inside fenced code blocks (
```or~~~) are treated as safe and skipped. - Lines inside a
::: v-preblock, or any line containing av-preattribute (e.g.<code v-pre>,<span v-pre>), are treated as safe and skipped. - Fails (exit
1) and printsfile:linefor 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//:::
- Inline code:
- Dual-mode: in CI / standalone runs with no arguments it discovers all
docs/**/*.md; under prek / pre-commit the staged.mdfiles are passed as arguments.