Skip to main content

TeachBooks Zoomies

A simple Sphinx extension to integrate Viewer.js for image zooming in Jupyter Books and Sphinx documentation.

Features

  • Pinch & Zoom: Smooth, mobile-friendly zooming for all your images.
  • Theme Integrated: Automatically adapts to light and dark modes, using your theme's native colors.
  • Smart Captions: Automatically pulls captions from <figure> elements to display them in the viewer.
  • Best-Fit Logic: Intelligently scales images to fit your viewport (configurable).
  • Customizable Toolbar: Choose exactly which tools (zoom, rotate, reset) are available to your readers.

Installation

pip install teachbooks-zoomies

Usage

Jupyter Book

Add the extension to your _config.yml:

sphinx:
  extra_extensions:
    - teachbooks_zoomies

Sphinx

Add the extension to your conf.py:

extensions = [
    # ...
    'teachbooks_zoomies',
]

Configuration

TeachBooks Zoomies works out-of-the-box with PyData-based themes (like the Jupyter Book default), but you can fully customize it in your _config.yml (Jupyter Book) or conf.py (Sphinx).

Options

Option Default Description
zoomies_selector ".bd-article img, #pst-secondary-sidebar img" CSS selector for images that should be zoomable.
zoomies_best_fit 70 Initial zoom level as a % of the viewport (1-100).
zoomies_toolbar ["zoomIn", "zoomOut", "oneToOne", "reset"] Tools to show. Options: zoomIn, zoomOut, oneToOne, reset, prev, play, next, rotateLeft, rotateRight, flipHorizontal, flipVertical.
zoomies_bg_color_light "color-mix(in srgb, var(--pst-color-background) 95%, transparent)" Viewer background color in light mode.
zoomies_bg_color_dark "color-mix(in srgb, var(--pst-color-background) 95%, transparent)" Viewer background color in dark mode.
zoomies_caption_color_light "var(--pst-color-text-base)" Caption text color in light mode.
zoomies_caption_color_dark "var(--pst-color-text-base)" Caption text color in dark mode.
zoomies_cdn_css "https://unpkg.com/viewerjs/dist/viewer.min.css" URL for the Viewer.js CSS file.
zoomies_cdn_js "https://unpkg.com/viewerjs/dist/viewer.min.js" URL for the Viewer.js JS file.

Example _config.yml (Jupyter Book)

sphinx:
  config:
    zoomies_selector: ".bd-article img, #pst-secondary-sidebar img, .my-custom-image-class"
    zoomies_best_fit: 85
    zoomies_toolbar: ["zoomIn", "zoomOut", "reset", "rotateRight"]

Example conf.py (Sphinx)

zoomies_selector = ".bd-article img, #pst-secondary-sidebar img"
zoomies_best_fit = 80

Disabling Zoom for Specific Images

If you want to prevent specific images from being zoomable, you can add the class no-zoomies to the image itself or to any of its parent containers.

1. In Markdown (MyST Directive)

This is the recommended way for Jupyter Books.

```{image} path/to/image.png
:class: no-zoomies
```

2. Using an HTML Tag

If you are writing raw HTML in your documentation.

<img src="path/to/image.png" class="no-zoomies">

3. Using a Parent Container

Useful for disabling zoom on a group of images at once.

<div class="no-zoomies">
  ![This image won't zoom](image1.png)
  ![This one won't either](image2.png)
</div>

Metadata

Release files for teachbooks-zoomies 0.2.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for teachbooks-zoomies 0.2.5
File Size Uploaded Provenance
teachbooks_zoomies-0.2.5.tar.gz 9.3 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for teachbooks-zoomies 0.2.5
File Interpreter ABI Platform
teachbooks_zoomies-0.2.5-py3-none-any.whl Python 3 none any Details

Total release size: 18.9 kB

Release files / teachbooks_zoomies-0.2.5.tar.gz

Download URL teachbooks_zoomies-0.2.5.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
b85611e6028b7c763187338f454c46fadd57f9aa9dc23325e521204b7a5047d7
BLAKE2b-256 checksum
How to use checksums
9c7fc14ae8da97331bdd1ded153daebfb5ddc7aa1aa6f5e3fac303ac73ecd25e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.

Transparency log

Release files / teachbooks_zoomies-0.2.5-py3-none-any.whl

Download URL teachbooks_zoomies-0.2.5-py3-none-any.whl
Size 9.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ea956ac0b55cd15272a2c4f95f01c419da00e0d4a3727c14b54a1d0cf093a66d
BLAKE2b-256 checksum
How to use checksums
58654136655afb8ca1a77f2c42991f3207f8b52c0cbc5366f9a6b8eaba6c2219
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.

Transparency log

Security for teachbooks-zoomies 0.2.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for teachbooks_zoomies-0.2.5.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

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