mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
Remove safe_mode=True for Markdown2, as most things go straight through allowlist_html, and it mangles code in <code> blocks
This commit is contained in:
parent
5e2ec8f9d9
commit
bdb201f4d3
1 changed files with 1 additions and 1 deletions
|
@ -310,7 +310,7 @@ def allowlist_html(html: str, a_target='_blank') -> str:
|
||||||
# this is for pyfedi's version of Markdown (differs from lemmy for: newlines for soft breaks, ...)
|
# this is for pyfedi's version of Markdown (differs from lemmy for: newlines for soft breaks, ...)
|
||||||
def markdown_to_html(markdown_text, anchors_new_tab=True) -> str:
|
def markdown_to_html(markdown_text, anchors_new_tab=True) -> str:
|
||||||
if markdown_text:
|
if markdown_text:
|
||||||
raw_html = markdown2.markdown(markdown_text, safe_mode=True,
|
raw_html = markdown2.markdown(markdown_text,
|
||||||
extras={'middle-word-em': False, 'tables': True, 'fenced-code-blocks': True, 'strike': True, 'breaks': {'on_newline': True, 'on_backslash': True}})
|
extras={'middle-word-em': False, 'tables': True, 'fenced-code-blocks': True, 'strike': True, 'breaks': {'on_newline': True, 'on_backslash': True}})
|
||||||
return allowlist_html(raw_html, a_target='_blank' if anchors_new_tab else '')
|
return allowlist_html(raw_html, a_target='_blank' if anchors_new_tab else '')
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Reference in a new issue