From dd6d9c7d36d0a09db647a8fc993f7330388a1e48 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Sat, 6 Nov 2021 22:24:59 +0000 Subject: [PATCH] add slide numbering (#1654) * add slide numbering - fixes #737 * Update slides.py Co-authored-by: Sylvain Corlay --- nbconvert/exporters/slides.py | 8 ++++++++ share/jupyter/nbconvert/templates/reveal/index.html.j2 | 2 ++ 2 files changed, 10 insertions(+) diff --git a/nbconvert/exporters/slides.py b/nbconvert/exporters/slides.py index 431a2d900..e5665bb07 100644 --- a/nbconvert/exporters/slides.py +++ b/nbconvert/exporters/slides.py @@ -155,6 +155,13 @@ def _reveal_url_prefix_default(self): """ ).tag(config=True) + reveal_number = Unicode('', + help=""" + slide number format (e.g. 'c/t'). Choose from: + 'c': current, 't': total, 'h': horizontal, 'v': vertical + """ + ).tag(config=True) + font_awesome_url = Unicode( "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css", help=""" @@ -172,4 +179,5 @@ def _init_resources(self, resources): resources['reveal']['theme'] = self.reveal_theme resources['reveal']['transition'] = self.reveal_transition resources['reveal']['scroll'] = self.reveal_scroll + resources['reveal']['number'] = self.reveal_number return resources diff --git a/share/jupyter/nbconvert/templates/reveal/index.html.j2 b/share/jupyter/nbconvert/templates/reveal/index.html.j2 index 8515572a2..3d4e78b08 100644 --- a/share/jupyter/nbconvert/templates/reveal/index.html.j2 +++ b/share/jupyter/nbconvert/templates/reveal/index.html.j2 @@ -5,6 +5,7 @@ {% set reveal_url_prefix = resources.reveal.url_prefix | default('https://unpkg.com/reveal.js@4.0.2', true) %} {% set reveal_theme = resources.reveal.theme | default('white', true) %} {% set reveal_transition = resources.reveal.transition | default('slide', true) %} +{% set reveal_number = resources.reveal.number | default('', true) %} {% set reveal_scroll = resources.reveal.scroll | default(false, true) | json_dumps %} {%- block header -%} @@ -144,6 +145,7 @@ require( progress: true, history: true, transition: "{{reveal_transition}}", + slideNumber: "{{reveal_number}}", plugins: [RevealNotes] });