index.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. module.exports = {
  2. book: {
  3. assets: "./book",
  4. js: [
  5. "test.js"
  6. ],
  7. css: [
  8. "test.css"
  9. ]
  10. },
  11. hooks: {
  12. // For all the hooks, this represent the current generator
  13. // This is called before the book is generated
  14. "init": function() {
  15. console.log("init!");
  16. },
  17. // This is called after the book generation
  18. "finish": function() {
  19. console.log("finish!");
  20. },
  21. // The following hooks are called for each page of the book
  22. // and can be used to change page content (html, data or markdown)
  23. // Before parsing markdown
  24. "page:before": function(page) {
  25. // page.path is the path to the file
  26. // page.content is a string with the file markdown content
  27. // Example:
  28. //page.content = "# Title\n" + page.content;
  29. return page;
  30. },
  31. // Before html generation
  32. "page": function(page) {
  33. // page.path is the path to the file
  34. // page.content is a list of parsed sections
  35. // Example:
  36. //page.content.unshift({type: "normal", content: "<h1>Title</h1>"})
  37. return page;
  38. },
  39. // After html generation
  40. "page:after": function(page) {
  41. // page.path is the path to the file
  42. // page.content is a string with the html output
  43. // Example:
  44. //page.content = "<h1>Title</h1>\n" + page.content;
  45. // -> This title will be added before the html tag so not visible in the browser
  46. return page;
  47. }
  48. }
  49. };