Last active
June 1, 2017 21:18
-
-
Save takluyver/bfad315881a7f9be54ca4d18bd79d58c to your computer and use it in GitHub Desktop.
Pass extra variables to nbconvert template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Pass an extra variable to an nbconvert template | |
# Untested | |
from nbconvert.exporters import HTMLExporter | |
class MyExporter(HTMLExporter): | |
def from_notebook_node(self, nb, resources=None, my_var=None, **kw): | |
self.environment.globals['my_var'] = my_var | |
return super().from_notebook_node(nb, resources=resources, **kw) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment