forked from GitbookIO/plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
62 lines (49 loc) · 1.65 KB
/
index.js
File metadata and controls
62 lines (49 loc) · 1.65 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
module.exports = {
book: {
assets: "./book",
js: [
"test.js"
],
css: [
"test.css"
]
},
hooks: {
// For all the hooks, this represent the current generator
// This is called before the book is generated
"init": function() {
console.log("init!");
},
// This is called after the book generation
"finish": function() {
console.log("finish!");
},
// The following hooks are called for each page of the book
// and can be used to change page content (html, data or markdown)
// Before parsing markdown
"page:before": function(page) {
// page.path is the path to the file
// page.content is a string with the file markdown content
// Example:
//page.content = "# Title\n" + page.content;
return page;
},
// Before html generation
"page": function(page) {
// page.path is the path to the file
// page.content is a list of parsed sections
// Example:
//page.content.unshift({type: "normal", content: "<h1>Title</h1>"})
return page;
},
// After html generation
"page:after": function(page) {
// page.path is the path to the file
// page.content is a string with the html output
// Example:
//page.content = "<h1>Title</h1>\n" + page.content;
// -> This title will be added before the html tag so not visible in the browser
return page;
}
}
};