Skip to content

Commit

Permalink
Fix ignore emojis (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
blueswen committed Jul 26, 2022
1 parent f91165f commit 732ee1a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
mkdocs-glightbox-0.1.7 (2022-07-26)

* Fix #1: Ignore Emojis

mkdocs-glightbox-0.1.6 (2022-07-16)

* Fix some options not working bug
Expand Down
4 changes: 4 additions & 0 deletions mkdocs_glightbox/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,13 @@ def on_post_page(self, output, page, config, **kwargs):

def on_page_content(self, html, page, config, **kwargs):
""" Wrap img tag with archive tag with glightbox class and attributes from config """
# skip emoji img with index as class name from pymdownx.emoji https://facelessuser.github.io/pymdown-extensions/extensions/emoji/
skip_class = ["emojione", "twemoji", "gemoji"]
soup = BeautifulSoup(html, "html.parser")
imgs = soup.find_all("img")
for img in imgs:
if set(skip_class) & set(img.get("class", [])):
continue
a = soup.new_tag("a")
a["class"] = "glightbox"
a["href"] = img.get("src", "")
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setup(
name="mkdocs-glightbox",
version="0.1.6",
version="0.1.7",
author="Blueswen",
author_email="blueswen.tw@gmail.com",
url = "https://blueswen.github.io/mkdocs-glightbox",
Expand Down

0 comments on commit 732ee1a

Please sign in to comment.