Skip to content

nbsphinx causes sphinx-gallery to have undefined labels #1381

Open
@Rob-Fletcher

Description

I am trying to use sphinx-gallery to render code in RST files. Some of these examples contain jupyter widgets, specifically ipyleaflet. When I include nbsphinx in extensions in my conf.py there are warnings thrown towards the end of the build that say that the autogenerated RST files from sphinx-gallery are undefined

docs/source/auto_examples/boson/index.rst:26: WARNING: undefined label: 'sphx_glr_auto_examples_boson_plot_adding_arcgis_service.py' [ref.ref]

This also causes the gallery on the rendered docs page to be broken. Clicking the gallery item does nothing. Seems like no anchor tag is generated in the resulting HTML. If I open the generated HTML file directly for the example, I do see the widget working properly.
image

If I remove nbsphinx from the extensions, then the build works properly and the gallery links to the example page, however, instead of generating a widget only text output is shown.
image

Is there any way to make these two libraries work together?

sphinx==8.0.2
nbsphinx==0.9.5
sphinx-gallery==0.17.1

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions