As the title suggests: I'd like to extend the reveal template of jupyter's nbconvert and add some custom <style type="text/css"> ... </style>
and <script> ... </script>
blocks right before the end of the </head>
.
I'm currently using Linux and anaconda3 with jupyter 4.7
and nbconvert 6.0.7
.
I created a folder called reveal_extension in ~/anaconda3/share/jupyter/nbconvert/templates/
with the files:
- conf.json
- base.html.j2
conf.json is a copy of the conf.json file of the reveal template, with "base_template": "reveal",
base.html.j2 is a new file with the following content:
{%- extends 'reveal/base.html.j2' -%}
{%- block html_head -%}
{{ super() }}
<style type="text/css">
CSS-code
</style>
<script>
javascript-code
</script>
{%- endblock html_head -%}
When I compile my jupyter.ipynb notebook with this template, I get a valid output with reveal.js but without my additional code.
jupyter nbconvert jupyter.ipynb --to slides --template=reveal_extension
When I manually add the code in the output jupyter.slides.html file, everything works as expected.
What am I doing wrong?
How can I insert additional code in the reveal.js presentation with nbconvert using a template?