vite-plugin-md-data
vite-plugin-md-data
Getting Started
Install
> npm install -D vite-plugin-md-data
Add the below to vite.config.js.
You have to pass the options having path property which is used to specify the directory containing markdown files.
import vue from '@vitejs/plugin-vue'
import ViteMdData from 'vite-plugin-md-data'
export default {
plugins: [
vue(),
ViteMdData({
path: './dev/posts/',
callback: (data) => data.filter(d => d.publised === true), // Callback to process for markdown data.
asRaw: false, // Not parse the content to HTML if `true`.
declaration: { // Generate d.ts file.
outDir: './types/' // Path to which generate a declaration.
}
})
]
}
And you can import path, frontmatter, and content via virtual:vite-plugin-md-data like below.
<script setup>
import { data } from 'virtual:vite-plugin-md-data'
console.log(data)// [{ path: '...', frontmatter: { ... }, content: '<h2>...</h2>...' }, { ... }]
</script>
Also, this may be needed.
Related Packages
vite-plugin-checker
Vite plugin that runs TypeScript type checker on a separate process.
133,975,562
1,242
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 1.3.3 | ^3.2.36 | MIT | |
| 1.3.2 | ^3.2.36 | MIT | |
| 1.3.0 | ^3.2.36 | MIT | |
| 1.2.0 | ^3.2.36 | MIT | |
| 1.1.0 | ^3.2.36 | MIT | |
| 1.0.0 | ^3.2.36 | MIT | |
| 0.2.0 | ^3.2.36 | MIT | |
| 0.1.2 | ^3.2.36 | MIT | |
| 0.1.1 | ^3.2.36 | MIT | |
| 0.1.0 | ^3.2.36 | MIT |