Customized plain text render to hide select elements #686
djfarrelly
started this conversation in
Ideas
Replies: 1 comment
-
So, I'm currently looking for the exact same feature. With the code snippet you have linked it seems to be a one line addition (now in here). Just adding a class that hides the element in plainText mode. I've searched for it, but didn't find a PR. Did you open one yet? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Goals
Background
The company logo in our email template is hyperlinked to our website and rendering our emails to plaintext gives us:
Email code:
What I want is to hide that link that wraps our logo:
Proposal
This could be solved w/ a special classname or data attribute that can be passed which filter uses in it's rules to remove:
https://github.com/resendlabs/react-email/blob/d158ad77e3798808b4efbd322b618922da12529e/packages/render/src/render.ts#L31-L34
Suggested options
dataPlainText={false}
(or similar) attribute inrenderAsPlainText
__react-email-plaintext-skip
to hide elements inrenderAsPlainText
<PlainText hide={true}>{children}</PlainText>
or similar component that can wrap elements to hide on plaintext renders<Visible plaintext>{children}</Visible>
/<Visible html>{children}</Visible>
/<Visible html plaintext>{children}</Visible>
that can wrap elements and the user can explicitly set if they want something to render on one or the other.Current workaround
My current hack is to use
__react-email-preview
, although it's not good HTML to have multiples of the sameid
attr.Beta Was this translation helpful? Give feedback.
All reactions