def remove_html_tags()

in foundation_security_advisories/common.py [0:0]


def remove_html_tags(content: str | None):
    """Executes `remove_newlines` and replaces <br> tags with '\\n', <code> tags with '`' and removes all other tags."""
    if not content:
        return None
    content = remove_newlines(content)
    content = HTML_BR_TAG_RE.sub("\n", content)
    content = HTML_CODE_TAG_RE.sub("`", content)
    content = HTML_TAG_RE.sub("", content)
    return content