feat(slides): Allow reveal.js configuration from notebook metadata#5
Merged
bouzidanas merged 1 commit intomainfrom Dec 13, 2025
Merged
feat(slides): Allow reveal.js configuration from notebook metadata#5bouzidanas merged 1 commit intomainfrom
bouzidanas merged 1 commit intomainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request introduces a new feature that allows
reveal.jspresentation settings to be configured directly within a notebook's metadata.Currently,
reveal.jsoptions for slide exports are primarily set via command-line arguments or configuration files. This separates the presentation's configuration from its content, making it less portable. For example, if a user wants to share a notebook that is designed to be presented with a specific theme or transition, they must also share the command-line flags needed to reproduce it.This enhancement allows users to embed
reveal.jssettings within the.ipynbfile itself, making presentations self-contained and easier to share and reproduce consistently.Implementation Details
The feature is implemented by overriding the
from_notebook_nodemethod in theSlidesExporter. The new implementation preserves the existing conversion logic by first callingsuper().from_notebook_node(). It then inspects the notebook's metadata for arevealkey and merges the settings with the configuration already loaded from command-line options and defaults.A clear order of precedence is maintained to ensure intuitive and predictable behavior:
--SlidesExporter.reveal_theme=night) have the highest priority.This ensures that users can set project-wide defaults in a notebook but still easily override them from the command line for a specific export.
How to Use
To use this feature, a user can edit the notebook's metadata (e.g., in Jupyter, via
Edit > Edit Notebook Metadata) and add arevealobject.Example Notebook Metadata:
{ "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "name": "python", "version": "3.9.7" }, "reveal": { "theme": "sky", "transition": "zoom", "scroll": true } }When a notebook with this metadata is exported using
jupyter nbconvert --to slides, it will automatically use the "sky" theme and "zoom" transition, unless a different value is provided on the command line.