SparkPost / heml

HEML is an open source markup language for building responsive email.
https://heml.io
MIT License
4.33k stars 157 forks source link

Add a plaintext renderer #10

Open avigoldman opened 6 years ago

avigoldman commented 6 years ago

Being able to render to the email as a plain text file will great as it will let users write their content in a single place and get it in both of the formats they'll need to send out.

Braindump time

I'm not sure what the best interface for the package/cli is. I'm leaning towards a flag on the CLI but I can also see it as a separate command. Maybe also an option for the develop command?

My initial thought is having an option of the file type to export to: either txt or eml which might point to more of a standalone command. (See #7)

For the implementation, I'm thinking a default plaintext function that gets added by the createElement that simply returns the content. For elements where that doesn't work, you override it. i.e. the img element returns the alt text and the image url.

Any and all suggestions are welcome! 🙌

karfau commented 6 years ago

Just a thought: Maybe tags can also have a plain text (or markdown, ...) representation? Otherwise I'm sure there are lots of tools to choose from that already attempt to convert HTML into plain text.

CharanyaR commented 6 years ago

@avigoldman I am interested in contribution, if someone can guide me a bit i can pick this up... as its my first time to do.

avigoldman commented 6 years ago

@karfau interesting thought. I'm not sure what behavior HTML to plaintext tools will have with email code that uses tables for the layouts. My thought with this is that we already know the desired output with each element so we can convert to text with more certainty.

@CharanyaR so psyched to get your help on this! I'll comment in here when I have more docs around how the internal work and how to contribute!

CharanyaR commented 6 years ago

@avigoldman Sure..keep me posted..so that i can get started...

schnelleyoga commented 6 years ago

thanks a lot )