You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* set draft of customlabextension
* add get_page_config hook
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* remove url param
* remove unused conf param
* add path to conf page
* use the hook to modify the default get_page function
* make page_config_hook optional
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update voila/app.py
Co-authored-by: Duc Trung Le <[email protected]>
* add server extension hoooks
* add page_config_hook documentation
* document hook
* Move hooks to VoilaConfiguration
* Add test
* Fix rebasing issue
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Duc Trung Le <[email protected]>
Co-authored-by: martinRenou <[email protected]>
Copy file name to clipboardExpand all lines: docs/customize.md
+73-9Lines changed: 73 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -226,7 +226,16 @@ There is a Voilà template cookiecutter available to give you a running start.
226
226
This cookiecutter contains some docker configuration for live reloading of your template changes to make development easier.
227
227
Please refer to the [cookiecutter repo](https://github.com/voila-dashboards/voila-template-cookiecutter) for more information on how to use the Voilà template cookiecutter.
228
228
229
-
### Accessing the tornado request (`prelaunch-hook`)
229
+
### Customizing Voila with Hooks
230
+
231
+
Voila provides hooks that allow you to customize its behavior to fit your specific needs. These hooks enable you to inject custom functions at certain points during Voila's execution, giving you control over aspects like notebook execution and frontend configuration.
232
+
233
+
Currently, Voila supports the following hooks:
234
+
235
+
- prelaunch_hook: Access and modify the Tornado request and notebook before execution.
236
+
- page_config_hook: Customize the page_config object, which controls the Voila frontend configuration.
237
+
238
+
#### Accessing the tornado request (`prelaunch-hook`)
230
239
231
240
In certain custom setups when you need to access the tornado request object in order to check for authentication cookies, access details about the request headers, or modify the notebook before rendering. You can leverage the `prelaunch-hook`, which lets you inject a function to inspect the notebook and the request prior to executing them.
232
241
@@ -240,7 +249,7 @@ Because `prelaunch-hook` only runs after receiving a new request but before the
- The last argument is the current working directory should you need to mutate anything on disk.
251
260
- The return value of your hook function can either be `None`, or a `NotebookNode`.
252
261
262
+
#### Customize the page config object (`page_config_hook`)
263
+
264
+
The page_config_hook allows you to customize the page_config object, which controls various aspects of the Voila frontend. This is useful when you need to modify frontend settings such as the URLs for static assets or other configuration parameters.
0 commit comments