Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with mj-html-attributes and templating language tags <% %> #2744

Open
cantoniriccardo opened this issue Sep 13, 2023 · 1 comment
Open

Comments

@cantoniriccardo
Copy link

Describe the bug
When we use mj-html-attributes and a templating language like EJS inside a compontent, a tag <%= my_variable %> is not preserved as is, but it is rendered as <%= my_variable="" %="" />.

To Reproduce
Steps to reproduce the behavior:

  1. Copy and paste the following code in the try-it-live tool:
<mjml>
  <mj-head>
    <mj-html-attributes>
      <mj-selector path=".custom div">
        <mj-html-attribute name="data-id">42</mj-html-attribute>
      </mj-selector>
    </mj-html-attributes>
  </mj-head>
  <mj-body>
    <mj-section>
      <mj-column>
        <mj-text css-class="custom">
          Hello <%= world %>
        </mj-text>
      </mj-column>
    </mj-section>
  </mj-body>
</mjml>
  1. See error

Expected behavior
We expect the tag <% ... %> to be rendered as is.

MJML environment

  • MJML Version 4.9.3
  • MJML try-it-live tool
@iRyusa
Copy link
Member

iRyusa commented Sep 13, 2023

Yup, I think this should be mentioned in the doc as it's not something we can fix. When Cheerio parse the document, any "look alike" xml/html will be treated as a xml tag so it will alter the output HTML

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants