Re: Email raw text to HTML - Mailing list pgsql-www

From Magnus Hagander
Subject Re: Email raw text to HTML
Date
Msg-id CABUevEwCeY5hmJFjOdqe57bkcvT2r6rD-V-HYDZEs_Mfnaeu4g@mail.gmail.com
Whole thread Raw
In response to Email raw text to HTML  (Sahil Harpal <sahilharpal1234@gmail.com>)
Responses Re: Email raw text to HTML  (Jacob Champion <jchampion@timescale.com>)
List pgsql-www
On Thu, Aug 4, 2022 at 11:55 AM Sahil Harpal <sahilharpal1234@gmail.com> wrote:
>
> Hello,
> I am curious about how Gmail converts plain text (Raw data) mail into a beautiful interface. Is there any library or
somethingthat 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
oroutlook. The motive is the text should be readable. It is not just about enclosing previous replies in the blockquote
tagbut 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
changecolor and background color for quoted text. But for this we actually need something that will help us to convert
rawtext 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



pgsql-www by date:

Previous
From: Sahil Harpal
Date:
Subject: Email raw text to HTML
Next
From: Jacob Champion
Date:
Subject: Re: Email raw text to HTML