Skip to content

Commit

Permalink
Handle emoji / unicode
Browse files Browse the repository at this point in the history
Similar to squidfunk/mkdocs-material#5126, certain emoji lead to the error `lxml.etree.ParserError: Document is empty`. This escapes them so to avoid that error.
  • Loading branch information
johnsca committed Aug 10, 2023
1 parent 4c9b1fb commit 38430bd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mkdocs_video/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Plugin(mkdocs.plugins.BasePlugin):


def on_page_content(self, html, page, config, files):
content = lxml.html.fromstring(html)
content = lxml.html.fromstring(html.encode("unicode-escape"))
tags = content.xpath(f'//img[@alt="{self.config["mark"]}" and @src]')
for tag in tags:
if not tag.attrib.get("src"):
Expand Down

0 comments on commit 38430bd

Please sign in to comment.