index.js 1.9 KB

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