Skip to content

Add support for full configuration of reveal slides in notebook metadata#2257

Open
bouzidanas wants to merge 21 commits intojupyter:mainfrom
bouzidanas:main
Open

Add support for full configuration of reveal slides in notebook metadata#2257
bouzidanas wants to merge 21 commits intojupyter:mainfrom
bouzidanas:main

Conversation

@bouzidanas
Copy link
Contributor

@bouzidanas bouzidanas commented Dec 14, 2025

(Suggested labels: enhancement, feature)

This pull request introduces a new feature that allows reveal.js presentation settings to be configured directly within a notebook's metadata.

Currently, reveal.js options 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 or edit the html file themselves which requires familiarity with reveal.js. Furthermore, only a limited number of reveal.js options are accessible via the command line and in the configuration files.

This enhancement allows users to embed reveal.js settings within the .ipynb file itself, making presentations self-contained and easier to share and reproduce consistently.

Implementation Details

The feature is implemented by overriding the from_notebook_node method in the SlidesExporter. The new implementation preserves the existing conversion logic by calling super().from_notebook_node(). It also inspects the notebook's metadata for a reveal key and merges the settings with the configuration already loaded from command-line options and defaults.

A clear order of precedence (override order) is maintained to ensure intuitive and predictable behavior:

  1. Command-line arguments (highest)
  2. Notebook metadata
  3. Config file
  4. Hard-coded defaults (lowest)

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 a reveal object.

Example Notebook Metadata:

{
  "kernelspec": {
    "display_name": "Python 3",
    "language": "python",
    "name": "python3"
  },
  "language_info": {
    "name": "python",
    "version": "3.9.7"
  },
+ "reveal": {
+   "theme": "night",
+   "transition": "zoom",
+   "scroll": true
+}
}

When a notebook with this metadata is exported using jupyter nbconvert --to slides, it will automatically use the "night" theme and "zoom" transition, unless a different value is provided on the command line.

List of config options

Related Issues

  1. Better support for reveal.js functionality #612
  2. Is there a simple way to customize Reveal.initialize arguments? #1851
  3. Add additional configuration options to SideExporter #849
  4. - bump reveal.js #2216 (new config options)

bouzidanas and others added 21 commits September 7, 2022 16:08
Working - ability to add section element dataset attribute via cell metadata
removed trailing spacing - cleaning
Update fork with latest changes
feat(slides): Allow reveal.js configuration from notebook metadata
Sanitize 'since' input in prep-release workflow
Feature development: Allow reveal.js configuration from notebook metadata with correct precedence
@petrelharp
Copy link

This would really help make jupyter a more functional platform for making presentations. Thanks for working on this! Where's the right way to document this - here?

@bouzidanas
Copy link
Contributor Author

bouzidanas commented Jan 3, 2026

Where's the right way to document this - here?

and also here I think...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants