Skip to main content

Click-to-enlarge images for Sphinx documentation

Project description

sphinx-lightbox

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 build Build distributions, run twine check, and validate archive contents
make all Run check, docs, 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

License

GPL-3.0-or-later.

Project details


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.5.0.tar.gz (29.9 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.5.0-py3-none-any.whl (29.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sphinx_lightbox-0.5.0.tar.gz
  • Upload date:
  • Size: 29.9 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.5.0.tar.gz
Algorithm Hash digest
SHA256 189fc20329b64b9db23da58c24627136ee3c8e394a647244418114163ee23e8f
MD5 5b9f929c33ac27f0373f7caeb34231fd
BLAKE2b-256 e21fc0f8eba0b7c91e549e503603daaee3743850c57b2af98ea0a91e0441190f

See more details on using hashes here.

Provenance

The following attestation bundles were made for sphinx_lightbox-0.5.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.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for sphinx_lightbox-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a4c0d130d6d54978436695f7659bf89cf3d77298ec1fd60a60a09d512223b708
MD5 224977dc510d23410dc1d0648fd99967
BLAKE2b-256 5e379de8e5f1561dc283862729eedd13af445104a8bbff71e7a59ab179f4dfef

See more details on using hashes here.

Provenance

The following attestation bundles were made for sphinx_lightbox-0.5.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.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page