import html def plaintext_to_html(text): text = ( "
" + "\n".join([f"{html.escape(x)}" for x in text.split("\n")]) + "