diff --git a/markdown2html.py b/markdown2html.py
index ce046fa..c6f199a 100644
--- a/markdown2html.py
+++ b/markdown2html.py
@@ -12,6 +12,7 @@ import concurrent.futures
import urllib.request
import base64
from .lib.bs4 import BeautifulSoup as bs4
+from .lib.bs4.element import Comment
from functools import partial
@@ -61,7 +62,7 @@ def markdown2html(markdown, basepath, re_render, resources, viewport_width, font
# remove comments, because they pollute the console with error messages
for comment_element in soup.find_all(
- text=lambda text: isinstance(text, bs4.Comment)
+ text=lambda text: isinstance(text, Comment)
):
comment_element.extract()