Skip to content

Commit

Permalink
access theme attribute directly (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
blueswen committed May 3, 2024
1 parent b0b63f8 commit 7d2c0ab
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions mkdocs_glightbox/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,14 @@ def on_post_page(self, output, page, config, **kwargs):
});
"""
js_code += f"const lightbox = GLightbox({json.dumps(lb_config)});\n"
if self.using_material or "navigation.instant" in config["theme"]._vars.get(
if self.using_material or "navigation.instant" in config["theme"].get(
"features", []
):
# support compatible with mkdocs-material Instant loading feature
js_code += "document$.subscribe(() => { lightbox.reload() });\n"
output = body_regex.sub(f'<body\\1<script id="init-glightbox">{js_code}</script></body>', output)
output = body_regex.sub(
f'<body\\1<script id="init-glightbox">{js_code}</script></body>', output
)

return output

Expand Down

0 comments on commit 7d2c0ab

Please sign in to comment.