render_notebook¶
-
nbreport.templating.
render_notebook
(notebook, context, jinja_env)¶ Render the Jinja-templated cells of a notebook.
Parameters: - notebook :
nbformat.NotebookNode
The notebook document. This can be created programatically via
nbformat.v4.new_notebook
or created from anipynb
file withnbformat.read
. Thisnotebook
is modified in place, though the function also returns the modifiednotebook
.- context :
dict
-like The template context. Usually this is constructed via
cookiecutter.generate.generate_context
.- jinja_env :
cookiecutter.environment.StrictEnvironment
The Jinja environment.
Returns: - notebook :
nbformat.NotebookNode
The notebook document with templated cells rendered.
Notes
This function operates on the
source
member of each cell in the notebook. Cell sources are treated as individual Jinja templates.- notebook :