mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-11-30 18:24:35 +01:00
Fixed HTML entities not escaped in social cards
This commit is contained in:
parent
67f17524d9
commit
b655e07805
@ -42,6 +42,7 @@ import sys
|
|||||||
|
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from hashlib import md5
|
from hashlib import md5
|
||||||
|
from html import unescape
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from mkdocs.commands.build import DuplicateFilter
|
from mkdocs.commands.build import DuplicateFilter
|
||||||
from mkdocs.exceptions import PluginError
|
from mkdocs.exceptions import PluginError
|
||||||
@ -298,8 +299,9 @@ class SocialPlugin(BasePlugin[SocialConfig]):
|
|||||||
width = size[0]
|
width = size[0]
|
||||||
lines, words = [], []
|
lines, words = [], []
|
||||||
|
|
||||||
# Remove remnant HTML tags
|
# Remove remnant HTML tags and convert HTML entities
|
||||||
text = re.sub(r"(<[^>]+>)", "", text)
|
text = re.sub(r"(<[^>]+>)", "", text)
|
||||||
|
text = unescape(text)
|
||||||
|
|
||||||
# Retrieve y-offset of textbox to correct for spacing
|
# Retrieve y-offset of textbox to correct for spacing
|
||||||
yoffset = 0
|
yoffset = 0
|
||||||
|
@ -42,6 +42,7 @@ import sys
|
|||||||
|
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from hashlib import md5
|
from hashlib import md5
|
||||||
|
from html import unescape
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from mkdocs.commands.build import DuplicateFilter
|
from mkdocs.commands.build import DuplicateFilter
|
||||||
from mkdocs.exceptions import PluginError
|
from mkdocs.exceptions import PluginError
|
||||||
@ -298,8 +299,9 @@ class SocialPlugin(BasePlugin[SocialConfig]):
|
|||||||
width = size[0]
|
width = size[0]
|
||||||
lines, words = [], []
|
lines, words = [], []
|
||||||
|
|
||||||
# Remove remnant HTML tags
|
# Remove remnant HTML tags and convert HTML entities
|
||||||
text = re.sub(r"(<[^>]+>)", "", text)
|
text = re.sub(r"(<[^>]+>)", "", text)
|
||||||
|
text = unescape(text)
|
||||||
|
|
||||||
# Retrieve y-offset of textbox to correct for spacing
|
# Retrieve y-offset of textbox to correct for spacing
|
||||||
yoffset = 0
|
yoffset = 0
|
||||||
|
Loading…
Reference in New Issue
Block a user