Skip to content

RTF Mails are rendered differently #651

Description

@Faelean

I think I've figured out what is happening so this is more of a "is there a workaround" issue.

One of our use cases is converting an email to HTML (via the getHTMLText function on the Email class) and display it in a browser. With the latest update of rtf-to-html the HTML is now wrapped with a <pre style="white-space:pre-wrap">. While this does preserve line breaks, it also adds the default browser styles for pre tags:

     display: block;
     font-family: monospace;
     white-space: pre;
     margin: 1em 0;

Especially the font-family: monospace; completely changes how the mail is displayed since it overrides the font from the one we provide with whatever monospace font is available on the system.
I also can't just add a style for the pre tag since (as far I've seen) when using the getHTMLText function I have no way of knowing if the original mail is an RTF or a HTML mail. Adding this style would possibly change the font of a pre tag inside an HTML mail, where a monospace font is wanted. My current idea is looking for <pre style="white-space:pre-wrap"> and replace it with a span. Do you have any input on how to make this work?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions