Webpack loader,加载 .md 文件,并返回文件内内容字符串,以实现使 webpack 可加载 .md 文件的功能
Webpack loader, loads .md files and returns the file's internal content string to enable webpack to load .md files.
npm install qing-markdown-loader -D
# 配置 loader,vue-cli 方式,vue.config.js 文件
chainWebpack: config => {
config.module
.rule('md').test(/\.md$/).use('md-loader').loader('qing-markdown-loader')
}
// hello.md文件内内容为:# hello world
import hello from './hello.md'
//# 输出 # hello world
console.log(hello)
- qing-markdown Vue Markdown 组件,可以将本地或远程 .md 文件以及 markdown 字符串解析为 HTML 显示