Fix random frontend (problem info, lazy load img, comment pagedown)
This commit is contained in:
parent
7bba448ef5
commit
3f53c62d4d
11 changed files with 131 additions and 96 deletions
|
@ -88,6 +88,7 @@ ALLOWED_ATTRS = [
|
|||
"frameborder",
|
||||
"allow",
|
||||
"allowfullscreen",
|
||||
"loading",
|
||||
]
|
||||
|
||||
|
||||
|
@ -105,11 +106,9 @@ def markdown(value, lazy_load=False):
|
|||
soup = BeautifulSoup(html, features="html.parser")
|
||||
for img in soup.findAll("img"):
|
||||
if img.get("src"):
|
||||
img["data-src"] = img["src"]
|
||||
img["src"] = ""
|
||||
img["loading"] = "lazy"
|
||||
for img in soup.findAll("iframe"):
|
||||
if img.get("src"):
|
||||
img["data-src"] = img["src"]
|
||||
img["src"] = ""
|
||||
img["loading"] = "lazy"
|
||||
html = str(soup)
|
||||
return '<div class="md-typeset content-description">%s</div>' % html
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue