def as_monospaced_html_email(content: str, title: str) -> str: """ Wraps `content` in a minimal, email-safe HTML template that forces monospace rendering across Gmail, Hotmail, Apple Mail, etc. Args: content: The body text (plain text or HTML-like). title: The title plaintext Returns: A complete HTML document string suitable for sending as an email body. """ # All line feed types should be removed and then this function should only be fed
's # Then it works with our
 styling without double linefeeds
    content = content.translate(str.maketrans('', '', '\r\n'))

    if title:
        import html
        title = html.escape(title)
    else:
        title = ''
    # 2. Full email-safe HTML
    html_email = f"""


  
  
  
  
  {title}


  
{content}
""" return html_email