From: | Magnus Hagander <magnus(at)hagander(dot)net> |
---|---|
To: | Sahil Harpal <sahilharpal1234(at)gmail(dot)com> |
Cc: | PostgreSQL WWW <pgsql-www(at)postgresql(dot)org> |
Subject: | Re: Email raw text to HTML |
Date: | 2022-08-04 14:04:12 |
Message-ID: | CABUevEwCeY5hmJFjOdqe57bkcvT2r6rD-V-HYDZEs_Mfnaeu4g@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-www |
On Thu, Aug 4, 2022 at 11:55 AM Sahil Harpal <sahilharpal1234(at)gmail(dot)com> wrote:
>
> Hello,
> I am curious about how Gmail converts plain text (Raw data) mail into a beautiful interface. Is there any library or something that will help us to transform plain text into HTML?
> I am aiming to represent text (email message body) as it is being displayed in any mailing services like gmail, yahoo or outlook. The motive is the text should be readable. It is not just about enclosing previous replies in the blockquote tag but we can even handle bold, italic, bullets, tables etc.
As a regular user of gmail, I think that would be a bad way to go. I
find gmails way of rendering emails is particularly bad when it comes
to things like inline code snippets etc. For one, it insists on not
using a monospace font...
It might be workable if it can be made a configurable thing with a
checkbox or so somewhere, but without that at least I think it would
be significantly worse. Others may have different opinions of course,
and are encouraged to express them :)
> For example:
> image1 => Gmail interface
> image2 => Mailing list view
For emails with lots of code snippets, which is pretty common on many
of our lists, I think you will find the opposite is true. The "gmail
way" may be easier in some ways for pure text emails (though I'm sure
that can be argued too).
> Is there any method to do this conversion?
>
> I tried replacing '>' to '| ' [image3]. And I think it is better than what is present. It will look better if we change color and background color for quoted text. But for this we actually need something that will help us to convert raw text to good looking HTML same as markdown does. But in case of markdown the syntax is different. For example it uses **text** for bold and gmail uses *text* for bold.
I don't think we should change the *conents* of the email ever,
period. How much logic do you have in there to make sure you only
change > in the case that it's an actual quote, and not when it's used
for other things, like in a diff or just random text? gmail gets this
wrong on a regular basis, and gmail has a lot more developer resources
behind it to maintain their code than we do.
Highlighting it in different colors I can be OK with. But not changing
the contents.
//Magnus
From | Date | Subject | |
---|---|---|---|
Next Message | Jacob Champion | 2022-08-04 17:21:33 | Re: Email raw text to HTML |
Previous Message | Sahil Harpal | 2022-08-04 09:55:18 | Email raw text to HTML |