Skip to content

Enable thumbnail galleries of notebooks #396

@namurphy

Description

@namurphy

Describe the problem/need and solution

Context
I'm working on a pull request to consider switching from nbsphinx to MyST-NB. Our documentation currently has thumbnail galleries that were created using the nbgallery directive from nbsphinx. The instructions in the MyST-NB documentation currently state that the notebooks should be included in a Sphinx :toctree: directive, which puts them in a table of contents format without thumbnail images.

Problem / Idea
I would like to use MyST-NB and be able to generate thumbnail galleries of example notebooks.

Solution

Ideally, I would like to be able to use a directive similar to nbgallery from nbsphinx when using MyST-NB. One possibility would be to make it so that this directive would be able to be used when MyST-NB is enabled as a Sphinx extension.

Another possibility would be to add an example in the documentation of how to use another Sphinx extension to create a thumbnail gallery while using MyST-NB for processing notebooks.

Benefit

The ability to generate a thumbnail gallery would remove a blocker that could prevent projects from switching to MyST-NB from nbsphinx or sphinx-gallery.

Guide for implementation

This comment describes a hack to generate a thumbnail gallery via nbsphinx while still using MyST-NB for tasks besides the thumbnail gallery.

My current understanding is that the code used to generate a thumbnail gallery has generally been bundled to the code used for processing notebooks. Ideally these would be decoupled from each other, which would make it easier to switch between sphinx-gallery, nbsphinx, and MyST-NB.

Along these lines, I'm also wondering if it would be possible to import only the nbgallery directive from nbsphinx to avoid needing to duplicate code.

Thank you!

Tasks and updates

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions