-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvusion.config.js
More file actions
75 lines (71 loc) · 2.84 KB
/
vusion.config.js
File metadata and controls
75 lines (71 loc) · 2.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
const path = require('path');
const hljs = require('highlight.js');
const iterator = require('markdown-it-for-inline');
module.exports = {
type: 'app',
version: '>=0.6.0',
extractCSS: true,
webpack: {
entry: {
bundle: ['babel-polyfill', './src/index.js'],
},
output: {
path: path.resolve(__dirname, './public'),
publicPath: '/public/',
},
resolve: {
alias: {
library$: path.resolve(process.cwd(), 'index.js'),
},
},
module: {
rules: [{
test: /\.md$/,
use: [{
loader: 'vue-loader',
options: {
preserveWhitespace: false,
},
}, {
loader: 'vue-markdown-html-loader',
options: {
wrapper: 'u-article',
// livePattern: {
// exec: (content) => [content, 'anonymous-' + hashSum(content)],
// },
// liveTemplateProcessor(template) {
// // Remove whitespace between tags
// template = template.trim().replace(/>\s+</g, '><');
// return `<div class="u-example">${template}</div>`;
// },
markdownIt: {
langPrefix: 'lang-',
html: true,
highlight(str, rawLang) {
let lang = rawLang;
if (rawLang === 'vue')
lang = 'html';
if (lang && hljs.getLanguage(lang)) {
try {
const result = hljs.highlight(lang, str).value;
return `<pre class="hljs ${this.langPrefix}${rawLang}"><code>${result}</code></pre>`;
} catch (e) {}
}
return '';
// const result = this.utils.escapeHtml(str);
// return `<pre class="hljs"><code>${result}</code></pre>`;
},
},
markdownItPlugins: [
[iterator, 'link_converter', 'link_open', (tokens, idx) => tokens[idx].tag = 'u-link'],
[iterator, 'link_converter', 'link_close', (tokens, idx) => tokens[idx].tag = 'u-link'],
],
},
}],
}],
},
},
webpackDevServer: {
contentBase: __dirname,
},
};