From 78024cb6b906855e7f5d94f0fe0dd3076dc59ca5 Mon Sep 17 00:00:00 2001 From: martinRenou Date: Thu, 24 Nov 2022 15:39:06 +0100 Subject: [PATCH] Deprecate "classic" template And allow for an alternative look which is "--template lab --show-margins" --- docs/source/customize.rst | 25 +++++++++++-------- .../jupyter/voila/templates/lab/index.html.j2 | 21 ++++++++++++++++ voila/app.py | 8 +++++- voila/configuration.py | 7 ++++++ voila/exporter.py | 22 ++++++++++++++-- voila/notebook_renderer.py | 1 + 6 files changed, 70 insertions(+), 14 deletions(-) diff --git a/docs/source/customize.rst b/docs/source/customize.rst index 6c43a6ee8..53d3595ff 100755 --- a/docs/source/customize.rst +++ b/docs/source/customize.rst @@ -86,6 +86,9 @@ System administrators who want to disable changing the theme, can pass ``--Voila .. note:: Changing the template from the notebook metadata may change in the future if this features moves to nbconvert. +.. warning:: + The "classic" template is being deprecated and its support will be removed in Voilà 1.0.0, an alternative is to use ``voila --template lab --show-margins`` to get a similar look. + Creating your own template ========================== @@ -247,7 +250,7 @@ Here is an example of the configuration file. This file needs to be placed in th """Do your stuffs here""" return notebook - c.Voila.prelaunch_hook = hook_function + c.Voila.prelaunch_hook = hook_function - Start Voila from a python script: @@ -273,7 +276,7 @@ Here is an example of a custom `prelaunch-hook` to execute a notebook with `pape from papermill.parameterize import parameterize_notebook # setup for papermill - # + # # these two blocks are done # to avoid triggering errors # in papermill's notebook @@ -423,7 +426,7 @@ For more information about these options, check out the `Jupyter Server `_ under the hood to render the notebooks so we can benefit from some of its advanced functionalities to hide code and output cells based on cell tags. To hide the cell output for every cell in your notebook that has been tagged (`how to tag `_) with "hide" in Voilà:: - + voila --TagRemovePreprocessor.remove_all_outputs_tags='{"hide"}' your_notebook.ipynb To hide both the code cell and the output cell (if any) for every cell that has been tagged with "hide":: diff --git a/share/jupyter/voila/templates/lab/index.html.j2 b/share/jupyter/voila/templates/lab/index.html.j2 index 7b299d59c..43f5a9307 100644 --- a/share/jupyter/voila/templates/lab/index.html.j2 +++ b/share/jupyter/voila/templates/lab/index.html.j2 @@ -27,6 +27,25 @@ display: none; } +{% if resources.show_margins %} + +{% endif %} {%- endblock html_head_css -%} {# this overrides the default behaviour of rendering static widgets #} @@ -42,6 +61,7 @@ {{ spinner.html() }} {{ voila_setup_helper_functions() }}