1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2024-11-27 17:00:54 +01:00

Fixed HTML entities not escaped in social cards

This commit is contained in:
squidfunk 2024-09-20 09:44:29 +02:00
parent 67f17524d9
commit b655e07805
No known key found for this signature in database
GPG Key ID: 5ED40BC4F9C436DF
2 changed files with 6 additions and 2 deletions

View File

@ -42,6 +42,7 @@ import sys
from collections import defaultdict
from hashlib import md5
from html import unescape
from io import BytesIO
from mkdocs.commands.build import DuplicateFilter
from mkdocs.exceptions import PluginError
@ -298,8 +299,9 @@ class SocialPlugin(BasePlugin[SocialConfig]):
width = size[0]
lines, words = [], []
# Remove remnant HTML tags
# Remove remnant HTML tags and convert HTML entities
text = re.sub(r"(<[^>]+>)", "", text)
text = unescape(text)
# Retrieve y-offset of textbox to correct for spacing
yoffset = 0

View File

@ -42,6 +42,7 @@ import sys
from collections import defaultdict
from hashlib import md5
from html import unescape
from io import BytesIO
from mkdocs.commands.build import DuplicateFilter
from mkdocs.exceptions import PluginError
@ -298,8 +299,9 @@ class SocialPlugin(BasePlugin[SocialConfig]):
width = size[0]
lines, words = [], []
# Remove remnant HTML tags
# Remove remnant HTML tags and convert HTML entities
text = re.sub(r"(<[^>]+>)", "", text)
text = unescape(text)
# Retrieve y-offset of textbox to correct for spacing
yoffset = 0