Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Years ago I made a Go library called `html2text' just for this:

https://github.com/jaytaylor/html2text/

https://jaytaylor.com/html2text

It takes HTML as input and generates markdown-esque plaintext, with the main focus being to make the plaintext version easy and pleasant to read for human beings. Then using MIME types*, you transmit both the rich html version alongside the generated text/plain version.

This is cool because it makes it easy to respect both rich clients (like Gmail et. al.) as well as command-line or other clients which work better with simple text.

Hope this helps folks have the best of both worlds! :) cheers

* n.b. To ensure this works properly, be sure to use the right MIME headers:

https://stackoverflow.com/questions/3902455/mail-multipart-a...



Yep, I do similar with all emails I send, run the html through a `html2text` transformer and attach that as the plaintext variant of the email.

Now whatever the receiver decides they want to view they can.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: