Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

myst-lightbox

A MyST plugin that automatically turns every figure and image on a page into a clickable lightbox, with caption, zoom, and gallery navigation.

Usage: Simply enable it in your myst.yml plugins list:

project:
  plugins:
    - https://raw.githubusercontent.com/choldgraf/myst-lightbox/main/src/index.mjs

It will automatically identify each image and figure in your content and make it lightboxed, if no link exists.

For example, click any image below.

A figure with a caption

This uses a myst {figure} directive:

A mountain lake at dusk

A mountain lake at dusk (the caption is shown in the lightbox too!).

A plain Markdown image

This uses markdown image syntax like ![]():

A forest path

The {image} role

This uses the {image} role:

Foggy forest

How it works

The plugin loads GLightbox from a CDN at page load and wires every figure/image in the page content as a single gallery. Click → open. Arrow keys → next/prev. +/- → zoom. Esc → close.

myst.yml
version: 1
project:
  id: myst-lightbox
  title: myst-lightbox
  github: https://github.com/choldgraf/myst-lightbox
  jupyter:
    binder:
      repo: https://github.com/executablebooks/thebe-binder-base
  plugins:
    - ../src/index.mjs
  toc:
    - file: index.md
    - file: reference.md

site:
  template: book-theme
  options:
    logo_text: myst-lightbox

docs/myst.yml