-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathindex.js
29 lines (28 loc) · 823 Bytes
/
index.js
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
var toc = require('markdown-toc');
var slug = require('github-slugid');
module.exports = {
book: {
assets: './assets',
css: [
"atoc.css"
],
js: [
"atoc.js"
]
},
hooks: {
"page:before": function (page) {
page.content = toc.insert(page.content, {
slugify: function (str) {
return slug(str.replace(/&.*?;/g, ''));
},
bullets: '*'
});
if (this.options.pluginsConfig.atoc.addClass) {
var className = this.options.pluginsConfig.atoc.className || 'atoc';
page.content = page.content + '\n\n\n<script type="text/javascript">var className=\'' + className + '\';</script>';
}
return page;
}
}
};