ipython/ipython — pull request #5947 by AlbertHilb (2014-06-04 23:36:33+00:00)
Title: Proposal for a hook system

1. Added a new class ```Hook``` to the ```IPython``` javascript namespace.
Hooks can be used by extensions to customize the html notebook behaviour.
They are essentially sequences of callbacks. To each callback is associated a number, the nice value. When the hook is executed, its callbacks are called in order based on their nice values, lower values are executed first.

Choosing appropriate nice values, extension authors can insert their callbacks at the planned positions in the execution queue.

```Hook``` object has three methods:
* ```add_callback``` is used to add a callback to the hook.
* ```remove_callback``` is used to remove a callback from the hook.
* ```execute``` is used to execute the hook callbacks. It accepts an array of data as parameter, its elements will be passed to the callbacks when called.

1. Added ```preprocess``` and ```postprocess``` hooks to markdown and heading cells.
The former can be used to modify the text that will be passed to the markdown renderer, the ladder to customize the rendering result before it is set into the output area.

Turned parts of the cell rendering logic into ```preprocess``` and ```postprocess``` callbacks.