MkDocs GLightbox Plugin

0.5.2 · active · verified Sat Apr 11

mkdocs-glightbox is an MkDocs plugin that integrates the GLightbox pure JavaScript lightbox library for image zooming and gallery functionality. It automatically applies a lightbox effect to images within your MkDocs documentation. The project is actively maintained with frequent updates, ensuring compatibility and feature enhancements.

Warnings

Install

Imports

Quickstart

To quickly get started, install the plugin and then enable it in your `mkdocs.yml` file under the `plugins` section. By default, it will automatically apply a lightbox effect to all images. For more advanced features like galleries, use the `data-gallery` attribute in your Markdown. Remember to explicitly list other desired plugins (like `search`) if you define a `plugins` section.

mkdocs.yml:
```yaml
site_name: My Docs with Lightbox
theme: material # Or any other MkDocs theme

plugins:
  - search # Keep default search if desired
  - glightbox:
      touchNavigation: true
      loop: false
      effect: zoom
      auto_caption: true
```

docs/index.md:
```markdown
# Welcome

This is an image with a lightbox effect:

![A descriptive alt text for the image](img/example.jpg)

This is another image, part of a gallery:

![Another image](img/another.png){ data-gallery="my-gallery" }

```

view raw JSON →