Skip to content

Commit

Permalink
added "manual" option
Browse files Browse the repository at this point in the history
  • Loading branch information
michalfapso committed Jan 31, 2024
1 parent 6f99fb8 commit 50bc180
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ GLightbox is a pure javascript lightbox library with mobile support.
caption_position: bottom
background: white
shadow: true
manual: false
```

| Option | Default | Description |
Expand All @@ -70,6 +71,7 @@ GLightbox is a pure javascript lightbox library with mobile support.
| caption_position | bottom | Default captions position. (bottom, top, left, right) |
| background | white | The background CSS of lightbox image. The background will shown when the image is transparent. You can use any CSS value for the background for example `#74b9ff` or `Gainsboro` or `none` for nothing. |
| shadow | true | Enable or disable the shadow of lightbox image. Disable it when the background is `none` to prevent shadow around the transparent image. |
| manual | false | When true, lightbox has to be enabled for each image manually by adding 'on-glb' class to it. |

Check more options information on [GLightbox Docs](https://github.com/biati-digital/glightbox#lightbox-options).

Expand Down
2 changes: 2 additions & 0 deletions demo-mkdocs/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ GLightbox is a pure javascript lightbox library with mobile support.
caption_position: bottom
background: white
shadow: true
manual: false
```

| Option | Default | Description |
Expand All @@ -68,6 +69,7 @@ GLightbox is a pure javascript lightbox library with mobile support.
| caption_position | bottom | Default captions position. (bottom, top, left, right) |
| background | white | The background CSS of lightbox image. The background will shown when the image is transparent. You can use any CSS value for the background for example `#74b9ff` or `Gainsboro` or `none` for nothing. |
| shadow | true | Enable or disable the shadow of lightbox image. Disable it when the background is `none` to prevent shadow around the transparent image. |
| manual | false | When true, lightbox has to be enabled for each image manually by adding 'on-glb' class to it. |

Check more options information on [GLightbox Docs](https://github.com/biati-digital/glightbox#lightbox-options).

Expand Down
3 changes: 2 additions & 1 deletion mkdocs_glightbox/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class LightboxPlugin(BasePlugin):
),
("background", config_options.Type(str, default="white")),
("shadow", config_options.Type(bool, default=True)),
("manual", config_options.Type(bool, default=False)),
)

def on_config(self, config):
Expand Down Expand Up @@ -146,7 +147,7 @@ def wrap_img_with_anchor(self, match, plugin_config, skip_class, meta):
classes = re.findall(r'class="([^"]+)"', img_attr)
classes = [c for match in classes for c in match.split()]

if meta.get("glightbox-manual", False):
if meta.get("glightbox-manual", False) or self.config["manual"]:
if "on-glb" not in classes:
return img_tag
else:
Expand Down
6 changes: 6 additions & 0 deletions schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@
"markdownDescription": "https://blueswen.github.io/mkdocs-glightbox/#usage",
"type": "boolean",
"default": true
},
"manual": {
"title": "When true, lightbox has to be enabled for each image manually by adding 'on-glb' class to it",
"markdownDescription": "https://blueswen.github.io/mkdocs-glightbox/#usage",
"type": "boolean",
"default": false
}
},
"additionalProperties": false
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/mkdocs-options.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ plugins:
auto_caption: true
background: none
shadow: false
manual: false

0 comments on commit 50bc180

Please sign in to comment.