GitbookIO/gitbook — pull request #525 by alexandreaquiles (2014-12-15 20:16:05+00:00)
Title: Hooks before and after ebook generation 

Solves issue #474.

Hooks `ebook:before` and `ebook:after` 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, among other things.

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() {
console.log("ebook:after");
}
}
};
```