(text)
return content
Safely convert html to markdown
Safely convert html to markdown
Safely convert html to markdown
def htmltomarkdown(text):
    """
    Safely convert html to markdown
    """

    try:
        content = html2markdown.convert(text)
    except Exception as exc:
        logger.warning(f"error={exc};text={text[:100]}")
        # Return escaped text
        content = html.escape(text)

    return content
def htmltomarkdown ( text ) : try : content = html2markdown . convert ( text ) except Exception as exc : logger . warning ( f"error={exc};text={text[:100]}" ) # Return escaped text content = html . escape ( text ) return content