npm install --save-dev html-loader markdown-loader
module.exports = {
configureWebpack: {
module: {
rules: [
{
test: /\.md$/,
use: [
{
loader: "html-loader"
},
{
loader: "markdown-loader",
options: {
/* your options here */
}
}
]
}
]
}
}
};
@/assets/markdowns/sample.md
にマークダウンが配置されているとして...
<template>
<div>
<div v-html="sampleMd"></div>
</div>
</template>
<script>
import sampleMd from "@/assets/markdowns/sample.md";
export default {
created() {
this.sampleMd = sampleMd;
}
};
</script>