Markdown to script.
// vite.config.js
import markdownToJs, { transformImports, transformVue } from 'vite-plugin-markdown-to-js';
export default {
plugins: [
markdownToJs({
transforms: [
transformImports({ defaultPrefix: 'demo', base: './' }),
transformVue({
importsAsComponents: true,
}),
],
render(output, env) {
return [
`<template><div>${output.html}</div></template>`,
output.script,
output.style
].join('\n');
},
markedOptions: {},
}),
],
};
MIT