|
@@ -12,19 +12,50 @@ module.exports = {
|
|
|
// For all the hooks, this represent the current generator
|
|
|
|
|
|
// This is called before the book is generated
|
|
|
- init: function() {
|
|
|
+ "init": function() {
|
|
|
console.log("init!");
|
|
|
},
|
|
|
|
|
|
// This is called after the book generation
|
|
|
- finish: function() {
|
|
|
+ "finish": function() {
|
|
|
console.log("finish!");
|
|
|
},
|
|
|
|
|
|
- // This is called for each page of the book
|
|
|
- // It can be used for modifing page content
|
|
|
- // It should return the new page
|
|
|
- page: function(page) {
|
|
|
+ // 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;
|
|
|
}
|
|
|
}
|