diff --git a/app/utils.py b/app/utils.py index 44d62329..d100c842 100644 --- a/app/utils.py +++ b/app/utils.py @@ -211,7 +211,9 @@ def allowlist_html(html: str) -> str: if tag.name == 'table': tag.attrs['class'] = 'table' - return str(soup) + # avoid returning empty anchors + re_empty_anchor = re.compile(r'<\/a>') + return re_empty_anchor.sub(r'\1', str(soup)) def markdown_to_html(markdown_text) -> str: