Mjml: [BUG] mj-raw does not output raw input

Created on 19 Feb 2018  ·  12Comments  ·  Source: mjmlio/mjml

Reproduction Steps:
Sandbox:
https://codesandbox.io/s/jv15p3pj9

Output HTML:
http://codebins.com/bin/4ldqokt

Expected behavior:

I expect everything inside mj-raw to not be touched

Observed behavior:

For some reason MJML is transforming it to like this, with nothing inside the for loop rendering an empty output:

      {% for line_item in line_items %}

    {% endfor %}

Screenshots and GIFs

Input:
image

Output:
image

MJML version:

3.3.5

Most helpful comment

It's normal as you're using double quotes inside double quotes which isn't valid in HTML or any language for the matter. Use single quotes inside double quotes

<a title="See manifest" href="https://${ENV,var='HEROKU_APP'}.herokuapp.com/">${ENV,var="HEROKU_APP"}</a>

All 12 comments

Saw the comment here https://github.com/mjmlio/mjml/issues/996

Encoding html entities fixes this issue for 3.3.5. I understand it's fixed in v4

Hi

Then we can close it 👍

Observed parsing issue using freemarker syntax inside

<mj-raw>
     <#if template.variable??>
         ${template.variable}
      </#if>
</mj-raw>

Expected behavior:
All the code inside mj-raw tag should not be touched and render correctly.

I've tried to wrap the freemarker code inside a <div> but no success.
You can try the code on mjml try it live.
Error :

element parse error : Error : invalid tagName: #if
end tag name: #if does not match the current start tag name: mj-raw

MJML 4

Can you share the whole template because it's working here

On Thu, Mar 8, 2018 at 8:44 PM, asaidi notifications@github.com wrote:

Observed parsing issue using freemarker syntax inside


<#if template.variable??>
${template.variable}

Expected behavior:
All the code inside mj-raw tag should not be touched and render correctly.

I've tried to wrap the freemarker code inside a

but no success.
You can try the code on mjml try it live https://mjml.io/try-it-live/.
Error :

element parse error : Error : invalid tagName: #if
end tag name: #if does not match the current start tag name: mj-raw

MJML 4


You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
https://github.com/mjmlio/mjml/issues/998#issuecomment-371601385, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAizzTJuHXLChAFWiF_No_bC4F9pyGnwks5tcYodgaJpZM4SKzyf
.

--
Cordialement,
Maxime BRAZEILLES

<mjml>
  <mj-body>
    <mj-container>
      <mj-section>
        <mj-column>
          <mj-raw>
            <#if template.variable??>
              ${template.variable}
            </#if>
          </mj-raw>
        </mj-column>
      </mj-section>
    </mj-container>
  </mj-body>
</mjml>

There's no more mj-container in MJML4. Can you double check your version ?

On Thu, Mar 8, 2018 at 9:10 PM, asaidi notifications@github.com wrote:







<#if template.variable??>
${template.variable}







You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
https://github.com/mjmlio/mjml/issues/998#issuecomment-371608984, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAizzVQynkmLCurK2yRNf_tYYWKw6iM4ks5tcZAggaJpZM4SKzyf
.

--
Cordialement,
Maxime BRAZEILLES

Uninstalled MJML and re-installed it. Works fine now.

mjml-core: 4.0.0
mjml-cli: 4.0.0

ps: mj-container is still used in the MJML4 doc, it's confusing.

Thanks

I still see the issue when using mj-raw inside td tag

For

<mjml>
  <mj-body>
    <mj-table>
      <tbody>
        <tr>
          <td>
            <ms-text>Text</ms-text>
          </td>
          <td>
            <mj-raw>
              DO NOT PARSE
            </mj-raw>
          </td>
        </tr>
      </tbody>
    </mj-table>

  </mj-body>
</mjml>

Outputs:

<table 0="[object Object]" 1="[object Object]" 2="[object Object]" border="0" style="cellspacing:0;color:#000;font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:22px;table-layout:auto;width:100%;">
  <tbody>
    <tr>
      <td>
        <ms-text>Text</ms-text>
          </td>
      <td>
        <mj-raw>
         <![CDATA[
              DO NOT PARSE
         ]]>
</table>

There's no need to add an mj-raw inside a ending tag as mj-table

But MJML breaks my template code otherwise

<td>
  <a title="See manifest" href="https://${ENV,var="HEROKU_APP"}.herokuapp.com/">${ENV,var="HEROKU_APP"}</a>
</td>

Becomes (notice spaces around HEROKU_APP):

<td>
  <a title="See manifest" href="https://${ENV,var=" HEROKU_APP "}.herokuapp.com/">${ENV,var="HEROKU_APP"}</a>
</td>

You can try on MJML 4.1 latest beta it should be fixed now

It's normal as you're using double quotes inside double quotes which isn't valid in HTML or any language for the matter. Use single quotes inside double quotes

<a title="See manifest" href="https://${ENV,var='HEROKU_APP'}.herokuapp.com/">${ENV,var="HEROKU_APP"}</a>
Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  ·  4Comments

plaisted picture plaisted  ·  4Comments

samatcd picture samatcd  ·  4Comments

karanmartian picture karanmartian  ·  3Comments

fmauNeko picture fmauNeko  ·  3Comments