How to output raw text in mjml-react?
See original GitHub issueHello,
We are using MGML React to output email templates that will then use handlebars when processing the final email.
For example, we have now
handlebars function with named parameter format
. When using React, it escapes the quote in the named parameter and breaks handlebars processing.
Neither MjmlText or MjmlRaw work.
<MjmlText>{`{{now format="YYYY"}}`}</MjmlText>
<MjmlRaw>{`{{now format="YYYY"}}`}</MjmlRaw>
outputs
<mj-text>{{now format='YYYY'}}</mj-text>
<mj-raw>{{now format='YYYY'}}</mj-raw>
“dangerouslySetInnerHTML” does not work either.
<MjmlText dangerouslySetInnerHTML={{ __html=`{{now format="YYYY"}}`}}/>
<MjmlText dangerouslySetInnerHTML={{ __html=`{{now format="YYYY"}}`}}/>
outputs
<mj-text dangerously-set-inner-html="[Object]"></mj-text>
<mj-raw dangerously-set-inner-html="[Object]"></mj-raw>
Any idea on how to do this in React or in MJML-React?
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
mjml-guides – Documentation for MJML - The Responsive ...
Command line interface. Compiles the file and outputs the HTML generated in output.html. mjml input.mjml -o output.html.
Read more >My Wonderful HTML Email Workflow - Josh W Comeau
I can right-click to view the raw HTML source, and copy/paste it into my mailing software. Link to this heading. Custom components with...
Read more >Writing Emails in React - lee.david.cs Blog
Introducing MJML-React. We've identified 2 pain-points of emails in Node.js thus far. Template literals lose types and intellisense ...
Read more >Essential Advice on How to Use MJML - Email On Acid
Find out how to get started with the MJML markup language for responsive emails. Watch an episode of Notes from the Dev and...
Read more >mjml-group - npm
On the output HTML, remove the blank space between the two columns inside a mj-group. attribute, unit, description, default attributes. width ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I have added the
MjmlHtml
component as an extension as it’s not theMjml*
element. The usage looks like:It is react library - use react for this. Otherwise you have two options:
mjml
directly. Potentially you don’t needmjml-react
.mjml-react