From 8349453adcb3d6a51a9301a162f518bfc55ed8dc Mon Sep 17 00:00:00 2001 From: blueswen Date: Thu, 29 Sep 2022 22:02:15 +0800 Subject: [PATCH] Support specific skip class (#5) --- mkdocs_glightbox/plugin.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mkdocs_glightbox/plugin.py b/mkdocs_glightbox/plugin.py index 0bd1a8b..035fbe6 100644 --- a/mkdocs_glightbox/plugin.py +++ b/mkdocs_glightbox/plugin.py @@ -22,6 +22,7 @@ class LightboxPlugin(BasePlugin): ("height", config_options.Type(str, default="auto")), ("zoomable", config_options.Type(bool, default=True)), ("draggable", config_options.Type(bool, default=True)), + ("skip_classes", config_options.Type(list, default=[])), ) def on_post_page(self, output, page, config, **kwargs): @@ -70,8 +71,8 @@ def on_page_content(self, html, page, config, **kwargs): plugin_config = {k: dict(self.config)[k] for k in ["width", "height"]} # skip emoji img with index as class name from pymdownx.emoji https://facelessuser.github.io/pymdown-extensions/extensions/emoji/ skip_class = ["emojione", "twemoji", "gemoji"] - # skip image with off-glb class - skip_class += ["off-glb"] + # skip image with off-glb and specific class + skip_class += ["off-glb"] + self.config['skip_classes'] soup = BeautifulSoup(html, "html.parser") imgs = soup.find_all("img") for img in imgs: