Skip to content

Commit

Permalink
Support configureable width and height of reveal presentations (#2104)
Browse files Browse the repository at this point in the history
Co-authored-by: franz haas <franz.haas@ams-osram.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
3 people committed Feb 6, 2024
1 parent b953703 commit dc91f33
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
20 changes: 20 additions & 0 deletions nbconvert/exporters/slides.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,24 @@ def _reveal_url_prefix_default(self):
""",
).tag(config=True)

reveal_width = Unicode(
"",
help="""
width used to determine the aspect ratio of your presentation.
Use the horizontal pixels available on your inteded presentation
equpment.
""",
).tag(config=True)

reveal_height = Unicode(
"",
help="""
height used to determine the aspect ratio of your presentation.
Use the horizontal pixels available on your inteded presentation
equpment.
""",
).tag(config=True)

font_awesome_url = Unicode(
"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css",
help="""
Expand All @@ -186,4 +204,6 @@ def _init_resources(self, resources):
resources["reveal"]["transition"] = self.reveal_transition
resources["reveal"]["scroll"] = self.reveal_scroll
resources["reveal"]["number"] = self.reveal_number
resources["reveal"]["height"] = self.reveal_height
resources["reveal"]["width"] = self.reveal_width
return resources
7 changes: 6 additions & 1 deletion share/templates/reveal/index.html.j2
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
{% 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_width = resources.reveal.width | default('960', true) %}
{% set reveal_height = resources.reveal.height | default('700', true) %}
{% set reveal_scroll = resources.reveal.scroll | default(false, true) | json_dumps %}

{%- block header -%}
Expand Down Expand Up @@ -154,7 +156,10 @@ require(
history: true,
transition: "{{reveal_transition}}",
slideNumber: "{{reveal_number}}",
plugins: [RevealNotes]
plugins: [RevealNotes],
width: {{reveal_width}},
height: {{reveal_height}},
});
var update = function(event){
Expand Down

0 comments on commit dc91f33

Please sign in to comment.