Vue in Markdown
Using Vue components, script setup, directives, and templating in markdown files
Interpolation
{{ 1 + 1 }}
{{ new Date().toLocaleDateString() }}Directives
<span v-for="i in 3">{{ i }}</span>
<div v-if="$frontmatter.showBanner">
Banner content
</div>Script and Style
---
title: My Page
---
<script setup>
import { ref } from 'vue'
import MyComponent from './MyComponent.vue'
const count = ref(0)
</script>
# {{ $frontmatter.title }}
Count: {{ count }}
<button @click="count++">Increment</button>
<MyComponent />
<style module>
.button {
color: red;
}
</style>Importing Components
Global Components
Runtime API
Global Variables
Components in Headers
Escaping Vue Syntax
Vue in Code Blocks
CSS Pre-processors
Using Teleports
VS Code IntelliSense
Key Points
Last updated
Was this helpful?