Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support configureable width and height of reveal presentations #2104

Merged
merged 3 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -1483,6 +1483,7 @@ raw template
{%- endblock in_prompt -%}
"""


exporter_attr = AttrExporter()
output_attr, _ = exporter_attr.from_notebook_node(nb)
assert "raw template" in output_attr
Expand Down
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
Loading