Skip to content

Commit

Permalink
Support specific skip class (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
blueswen committed Sep 29, 2022
1 parent 346a9f0 commit 8349453
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mkdocs_glightbox/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 8349453

Please sign in to comment.