UNPKG

1.57 kBJavaScriptView Raw
1var getPickerUtils = require('picidae-tools/node/getPickerUtils');
2
3
4module.exports = {
5 routes: [{
6 path: '/',
7 component: './Layout',
8 indexRoute: {
9 component: './PureMD',
10 data: {
11 a: 0
12 }
13 },
14 childRoutes: [
15 {
16 path: 'doc/*',
17 component: './Post',
18 data: {
19 a: 1
20 }
21 },
22 {
23 path: 'docs/:page',
24 component: './Archive'
25 },
26 {
27 path: 'changelog',
28 component: './PureMD'
29 },
30 {
31 path: 'about',
32 component: './PureMD'
33 },
34 {
35 path: 'guide',
36 component: './PureMD'
37 },
38 ]
39 }],
40 notFound: './NotFound',
41
42 root: './template',
43
44 plugins: [
45 // 'toc?depth=3'
46 ],
47
48 picker(metaData, gift, require) {
49 var content = gift.content,
50 filename = gift.filename,
51 getMarkdownData = gift.getMarkdownData,
52 path = gift.path;
53 var utils = getPickerUtils(metaData, gift, require);
54
55 return utils.getToc()
56 .then(function (toc) {
57 var meta = Object.assign(metaData, {toc: toc});
58 if (!path.includes('/')) {
59 return meta
60 }
61 return getMarkdownData().then(data => Object.assign(meta, {desc: data}))
62 })
63 },
64}
\No newline at end of file