Skip to main content

sphinx-lightbox

Tests and Docs Deployment PyPI version PyPI - Python Version PyPI - License

sphinx-lightbox is a Sphinx extension that turns standard .. image:: and .. figure:: directives into click-to-enlarge images in HTML output. It uses a CSS checkbox-toggle mechanism, progressively enhanced with a small JavaScript file for keyboard activation, focus management, Escape-to-close, and optional gallery navigation.

Documentation is published at https://aputtu.github.io/sphinx-lightbox/.

Quick Start

pip install sphinx-lightbox

Enable the extension in conf.py:

extensions = ["lightbox"]

Opt a standard image into lightbox behavior:

.. image:: /images/example.png
   :alt: Example image.
   :class: lightbox

Figures are transformed by default and keep their normal page caption:

.. figure:: /images/example.png
   :alt: Example figure.

   This caption is also shown in the lightbox overlay.

Development

Create a local virtual environment and install development dependencies:

make setup

Common commands:

Command Description
make test Run the pytest suite
make lint Run ruff check and ruff format --check
make type Run mypy
make check Run lint, type checks, and tests
make docs Build PDF docs, HTML docs, and validate generated HTML
make standards Validate generated HTML, CSS, and SVG with the Nu checker
make build Build distributions, run twine check, and validate archive contents
make all Run check, docs, standards, build, and dependency audit

The documentation build writes HTML to docs/_build/html/ and copies the PDF download into docs/_downloads/sphinx-lightbox.pdf before rebuilding HTML, the same pattern used by the GitHub Pages deployment workflow.

Project Layout

sphinx-lightbox/
|-- lightbox/                 Extension package
|   |-- lightbox.py
|   |-- py.typed
|   `-- static/
|       |-- lightbox.css
|       `-- lightbox.js
|-- docs/                     Sphinx documentation source
|   |-- _ext/                 Docs-only validation fixes
|   |-- _templates/           Accessible theme template overrides
|   |-- _downloads/           Generated PDF download location
|   `-- images/               Example images
|-- requirements/             Base, development, and docs requirements
|-- scripts/                  Local development and validation helpers
|-- tests/                    Unit and integration tests
|-- pyproject.toml
|-- tox.ini
`-- Makefile

Requirements

  • Python 3.10 or later
  • Sphinx 7.0 through 9.x
  • LaTeX tooling such as latexmk and texlive-latex-extra for PDF docs
  • Java 17 or later, curl, and sha256sum for the optional Nu standards gate

License

GPL-3.0-or-later.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sphinx_lightbox-0.6.0.tar.gz (36.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sphinx_lightbox-0.6.0-py3-none-any.whl (36.5 kB view details)

Uploaded Python 3

File details

Details for the file sphinx_lightbox-0.6.0.tar.gz.

File metadata

  • Download URL: sphinx_lightbox-0.6.0.tar.gz
  • Upload date:
  • Size: 36.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sphinx_lightbox-0.6.0.tar.gz
Algorithm Hash digest
SHA256 cb91a5459e3eee6f7309f1afa5d553eec381862fe1e80e15efaf2e1089184ff7
MD5 eee171b95685cf19503bd22ac318624d
BLAKE2b-256 30c6400f3baeff9349f6c8ed8fa66523128e5553bf727e3d4cd6535a8da42be9

See more details on using hashes here.

Provenance

The following attestation bundles were made for sphinx_lightbox-0.6.0.tar.gz:

Publisher: ci.yml on aputtu/sphinx-lightbox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sphinx_lightbox-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: sphinx_lightbox-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 36.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sphinx_lightbox-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 de96ccc0e1ae235988203dadb72b99a61092c8236a748cd1dbc07d5ccff164dc
MD5 f0f1954d23e6269d21dda872e47181ef
BLAKE2b-256 f6df6f8b016b91076d620653bcf9b1a4ad2c7b3eb7fd217d0beef56805c7b4ab

See more details on using hashes here.

Provenance

The following attestation bundles were made for sphinx_lightbox-0.6.0-py3-none-any.whl:

Publisher: ci.yml on aputtu/sphinx-lightbox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 files

0.5.1

2 files

0.5.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page