Skip to content

Markdown files don't have IntelliSense out of the box #4290

@salazarr-js

Description

@salazarr-js

Describe the bug

Markdown files in VitePress projects don't have IntelliSense support for Vue features by default when using the official Vue Volar plugin in VS Code.

Reproduction

  1. Create a new vitepress project using the setup wizard
npx vitepress init 
  1. Install the last version of the official vs code - vue plugin
    https://marketplace.visualstudio.com/items?itemName=Vue.volar

  2. Use any Vue features inside a markdown file
    https://vitepress.dev/guide/using-vue#using-vue-in-markdown

index.md

---
hello: world
---

<script setup>
import { ref } from 'vue'

const count = ref(0)
</script>

## Markdown Content

The count is: {{ count }}

<button :class="$style.button" @click="count++">Increment</button>

<style module>
.button {
  color: red;
  font-weight: bold;
}
</style>

Expected behavior

We can expect Vitepress and Volar to work seamlessly and provide IntelliSense feature out of the box on .md files, but according to this vue language tool merged PR, to achieve this, we have to follow a few steps.

VitePress Support

  1. Add .md to the tsconfig include option:
// tsconfig.json
{
    "include": [
   	 "src/**/*.ts",
   	 "src/**/*.vue",
        "src/**/*.md",
    ],
}
  1. Add .md to the tsconfig vueCompilerOptions.vitePressExtensions option:
// tsconfig.json
{
    "include": [
   	 "src/**/*.ts",
   	 "src/**/*.vue",
   	 "src/**/*.md",
    ],
    "vueCompilerOptions": {
      "vitePressExtensions": [".md"],
    },
}
  1. For VSCode support, add markdown to the VSCode vue.server.includeLanguages setting:
// .vscode/settings.json
{
    "vue.server.includeLanguages": ["vue", "markdown"]
}

These steps aren't mentioned on the vitepress documentation, I'd like to add those steps to the documentation but wanna be sure first if this has been taken into consideration

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (16) x64 AMD Ryzen 7 5800X 8-Core Processor
    Memory: 16.88 GB / 31.91 GB
  Binaries:
    Node: 20.17.0 - ~\AppData\Local\fnm_multishells\5536_1729010351260\node.EXE
    npm: 10.8.2 - ~\AppData\Local\fnm_multishells\5536_1729010351260\npm.CMD
  Browsers:
    Edge: Chromium (127.0.2651.86)
    Internet Explorer: 11.0.22621.3527
  npmPackages:
    vitepress: ^1.4.1 => 1.4.1
  VsCode Plugins
    vue.volar v2.1.6

Additional context

There is an open discussion at vuejs/eslint-plugin-vue repository to Add support for recognizing Vue components in .md files with the idea of improving the developer experience using Vitepress

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    contribution welcomeThe team would welcome a contribution from the community for this issuedocsImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions