sphinx-lightbox Documentation¶
Version: 0.5.0
Accessible click-to-enlarge images for Sphinx.
sphinx-lightbox is a Sphinx extension that provides click-to-enlarge image
viewing in HTML output using a CSS-driven checkbox-toggle mechanism, progressively
enhanced with lightweight JavaScript for keyboard activation, focus management,
and gallery navigation.
You can also download this documentation as a
PDF file.
Note
This documentation is self-referential: the live examples below are rendered by the extension you are reading about.
Project Homes¶
Image Example¶
Click the images below to see explicit lightbox handling for normal Sphinx
image directives. Use the previous and next controls, or the arrow
keys, to move through the gallery. Close the lightbox with the close icon,
by clicking outside the image, or with Esc, Enter, or Space.
Figure Example¶
Click the figure below to see the built-in figure caption and legend copied
into the lightbox overlay. Close the lightbox with the close icon, by
clicking outside the image, or with Esc, Enter, or Space.
Figure caption shown on the page and in the lightbox overlay.¶
This legend is longer explanatory text attached to the figure. It remains on the page and is also shown in the lightbox overlay.
Key Features¶
CSS-Driven Toggle — uses a highly robust checkbox-toggle pattern at its core, progressively enhanced with lightweight JavaScript for keyboard accessibility.
Sphinx-native image handling — images are registered with Sphinx’s collector, land in
_images/, and participate in incremental builds.Multi-builder support — full lightbox in HTML,
\includegraphicswith caption in LaTeX/PDF, plain image fallback in other builders.Accessibility-conscious design — visible focus indicators,
role="dialog",aria-modal, accessible control text,prefers-reduced-motion, focus management, andprefers-contrast: moresupport.Proper node architecture — custom docutils nodes with per-builder visitor functions, following Sphinx extension best practices.
GPL-3.0-or-later licensed open source.
Contents¶
User Guide
Reference