GitbookIO/gitbook — pull request #473 by alexandreaquiles (2014-10-13 15:15:40+00:00)
Title: Hooks before and after ebook generation

Improves on PR #464.

Added `ebook:before` and `ebook:after` hooks that are called, respectively, before and after the call to Calibre's `ebook-convert`.

The object with `ebook-convert` options is passed to `ebook:before`. Than, an user can create a plugin to change `ebook-convert` default options.

Example of use:
```
module.exports = {
hooks: {
"ebook:before": function(options) {
options["--disable-font-rescaling"] = true;
options["--chapter-mark"] = "none";
options["--level2-toc"] = "//h:h2",
options["--level3-toc"] = "";
options["-d debug"] = true;

console.log("ebook:before");

return options;
},
"ebook:after": function(options) {
console.log("ebook:after");
}
}
};
```