A MkDocs plugin supports image lightbox with GLightbox.
Install plugin from pypi
glightboxplugin to your mkdocs.yml plugins sections:
All images will be added to the lightbox effect automatically, except images in an anchor tag and emoji images from pymdown-extensions.
You may customize the plugin by passing options in mkdocs.yml:
Option Default Description touchNavigation true Enable or disable the touch navigation (swipe). loop false Loop slides on end. effect zoom Name of the effect on lightbox open. (zoom, fade, none) slide_effect slide Name of the effect on lightbox slide. (slide, zoom, fade, none) width 100% Width for inline elements and iframes. You can use any unit for example 90% or 100vw for full width. height auto Height for inline elements and iframes. You can use any unit for example 90%, 100vh or auto. zoomable true Enable or disable zoomable images. draggable true Enable or disable mouse drag to go prev and next slide. skip_classes [ ] Disable lightbox of those image with specific custom class name. auto_caption false Enable or disable using alt of image as caption title automatically. caption_position bottom Default captions position. (bottom, top, left, right)
Check more options information on GLightbox Docs.
- Support lightbox image caption, check more details on Caption.
- Support grouping images as galleries, check more details on Gallery.
How it works
- Copy GLightbox script file into
- Search all image tags and warp with an anchor tag for GLightbox excluded images with skip class or already warped with an anchor tag
Click the image to try lightbox and enjoy the view of Taiwan.
This project is licensed under the MIT License - see the LICENSE.md file for details.