API Reference

This page documents the internal Python API of sphinx-lightbox. The public authoring interface is standard Sphinx image and figure markup; see Image and Figure Reference. The Python API below is primarily useful for contributors.

Extension Setup

lightbox.lightbox.setup(app: Sphinx) returns dict[str, Any][source]

Nodes

class lightbox.lightbox.LightboxContainer(rawsource: str = '', *children, **attributes: Any)[source]

Outer wrapper grouping the trigger thumbnail and the overlay.

class lightbox.lightbox.LightboxTrigger(rawsource: str = '', *children, **attributes: Any)[source]

Thumbnail image that opens the lightbox when clicked.

class lightbox.lightbox.LightboxOverlay(rawsource: str = '', *children, **attributes: Any)[source]

Full-size image overlay with caption and close control.

Transforms

lightbox.lightbox.transform_lightbox_images(app: Sphinx, doctree: document, docname: str) returns None[source]

Convert standard image/figure nodes with class lightbox for HTML builds.

Assign per-document gallery metadata to lightbox overlays.