Programmatically pass variables in a custom jupyter nbconvert template

31 views Asked by At

I am trying to create a custom template for jupyter's nbconvert. In general, my custom template works. It applies a CSS file and sets a svg logo and such correctly.Within this template, I would also like to include a footer with the date of creation and the username. However, I am unable to pass the date and username variables to the template.

Intention

My intention is to somehow include variables into the template, which is called index.html.j2

{% block body_footer %}
        <p> Geneated on {{ current_date }} by {{ current_user }} </p>
{% endblock body_footer %}

Failed attempts

I have tried to include the variables as metadata in the jupyter notebook itself, unsuccesfully. I have also tried to set the variables as bash globals, and then to include them as metadata when calling nbconvert, but none of these appears to work.

Question

How can I pass variables while converting a jupyter notebook?

0

There are 0 answers