From 7c6b255b7f5cad966e4d4535bfc76972c48a751b Mon Sep 17 00:00:00 2001 From: Andrew Date: Mon, 12 Feb 2024 04:33:40 +0300 Subject: [PATCH] Update plugin.py --- mkdocs_glightbox/plugin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mkdocs_glightbox/plugin.py b/mkdocs_glightbox/plugin.py index 5da1385..8c36300 100644 --- a/mkdocs_glightbox/plugin.py +++ b/mkdocs_glightbox/plugin.py @@ -100,12 +100,12 @@ def on_post_page(self, output, page, config, **kwargs): element.setAttribute('href', imgSrc); }); """ - js_code += f"const lightbox = GLightbox({json.dumps(lb_config)});" + js_code += f"const lightbox = GLightbox({json.dumps(lb_config)});\n" if self.using_material or "navigation.instant" in config["theme"]._vars.get( "features", [] ): # support compatible with mkdocs-material Instant loading feature - js_code = "document$.subscribe(() => {" + js_code + "})" + js_code += "document$.subscribe(() => { lightbox.reload() });\n" output = body_regex.sub(f"{js_code}", output) return output