Skip to content

Commit

Permalink
Update documentation about registering file save hooks (#770)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbrochart committed Apr 8, 2022
1 parent 02e5f3a commit 80ac07e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/source/developers/savehooks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,15 @@ A post-save hook to make a script equivalent whenever the notebook is saved
This could be a simple call to ``jupyter nbconvert --to script``, but spawning
the subprocess every time is quite slow.

.. note::
Assigning a new hook to e.g. ``c.FileContentsManager.pre_save_hook`` will override any existing one.

If you want to add new hooks and keep existing ones, you should use e.g.:

.. code-block:: python
contents_manager.register_pre_save_hook(script_pre_save)
contents_manager.register_post_save_hook(script_post_save)
Hooks will then be called in the order they were registered.

0 comments on commit 80ac07e

Please sign in to comment.