Skip to content

Commit 80ac07e

Browse files
Update documentation about registering file save hooks (#770)
1 parent 02e5f3a commit 80ac07e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

docs/source/developers/savehooks.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,15 @@ A post-save hook to make a script equivalent whenever the notebook is saved
8282
8383
This could be a simple call to ``jupyter nbconvert --to script``, but spawning
8484
the subprocess every time is quite slow.
85+
86+
.. note::
87+
Assigning a new hook to e.g. ``c.FileContentsManager.pre_save_hook`` will override any existing one.
88+
89+
If you want to add new hooks and keep existing ones, you should use e.g.:
90+
91+
.. code-block:: python
92+
93+
contents_manager.register_pre_save_hook(script_pre_save)
94+
contents_manager.register_post_save_hook(script_post_save)
95+
96+
Hooks will then be called in the order they were registered.

0 commit comments

Comments
 (0)