mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
fenced code blocks
This commit is contained in:
parent
83f986d17f
commit
4fa8d13af5
1 changed files with 2 additions and 2 deletions
|
@ -199,7 +199,7 @@ def allowlist_html(html: str) -> str:
|
||||||
else:
|
else:
|
||||||
# Filter and sanitize attributes
|
# Filter and sanitize attributes
|
||||||
for attr in list(tag.attrs):
|
for attr in list(tag.attrs):
|
||||||
if attr not in ['href', 'src', 'alt']:
|
if attr not in ['href', 'src', 'alt', 'class']:
|
||||||
del tag[attr]
|
del tag[attr]
|
||||||
# Add nofollow and target=_blank to anchors
|
# Add nofollow and target=_blank to anchors
|
||||||
if tag.name == 'a':
|
if tag.name == 'a':
|
||||||
|
@ -251,7 +251,7 @@ def html_to_markdown_worker(element, indent_level=0):
|
||||||
|
|
||||||
def markdown_to_html(markdown_text) -> str:
|
def markdown_to_html(markdown_text) -> str:
|
||||||
if markdown_text:
|
if markdown_text:
|
||||||
return allowlist_html(markdown2.markdown(markdown_text, safe_mode=True, extras={'middle-word-em': False, 'tables': True}))
|
return allowlist_html(markdown2.markdown(markdown_text, safe_mode=True, extras={'middle-word-em': False, 'tables': True, 'fenced-code-blocks': True, 'spoiler': True}))
|
||||||
else:
|
else:
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue