Mjml: <mj-raw></mj-raw>

Created on 15 Aug 2019  Â·  5Comments  Â·  Source: mjmlio/mjml

Describe the bug

All <mj-raw> tags get rendered within the html output.

To Reproduce

Create a mjml template and render it with:

mjml('some mjml', {
    filePath: 'path/to/index.html'
  });

Expected behavior

No tags are in the output

MJML environment (please complete the following information):

  • OS: Ubuntu 19.04 / OSX
  • MJML Version 4.4.1

Most helpful comment

It's more specific, as it looks like to me. I recognized that behavior if I use inside a for example. Reproduced with the try live feature of the documentation (https://mjml.io/try-it-live/components/text) with the following example:

<mjml> <mj-body> <mj-section> <mj-column> <mj-text> <mj-raw>{% if title %}</mj-raw> <h1> Hey Title! </h1> <mj-raw>{% else %}</mj-raw> <h2> Hey Subtitle </h2> <mj-raw>{% endif %}</mj-raw> </mj-text> </mj-column> </mj-section> </mj-body> </mjml>

Also reproduced if used inside the following mjml tags.

  • mj-table
  • mj-accordion-title
  • mj-accordion-text
  • mj-button
  • mj-navbar-link
  • mj-social-element

Maybe I've missed something in the documentation.

All 5 comments

It's more specific, as it looks like to me. I recognized that behavior if I use inside a for example. Reproduced with the try live feature of the documentation (https://mjml.io/try-it-live/components/text) with the following example:

<mjml> <mj-body> <mj-section> <mj-column> <mj-text> <mj-raw>{% if title %}</mj-raw> <h1> Hey Title! </h1> <mj-raw>{% else %}</mj-raw> <h2> Hey Subtitle </h2> <mj-raw>{% endif %}</mj-raw> </mj-text> </mj-column> </mj-section> </mj-body> </mjml>

Also reproduced if used inside the following mjml tags.

  • mj-table
  • mj-accordion-title
  • mj-accordion-text
  • mj-button
  • mj-navbar-link
  • mj-social-element

Maybe I've missed something in the documentation.

There's no need for mj-raw within mj-text, you can just use the {% %} tags
directly in mj-text

Kind Regards,

:----------------------------:
Dale McConnell

On Thu, 15 Aug 2019 at 15:27, Philipp Jauss notifications@github.com
wrote:

It's more specific, as it looks like to me. I recognized that behavior if
I use inside a for example. Reproduced with the try live feature of the
documentation (https://mjml.io/try-it-live/components/text) with the
following example:

{% if title
%}

Hey Title!

{% else %}

Hey
Subtitle

{% endif %}

Also reproduced if used inside the following mjml tags.

-
-
-
-
-
-

Maybe I've missed something in the documentation.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/mjmlio/mjml/issues/1682?email_source=notifications&email_token=ACWEWOAGQ5PNAUZN4DNNG2TQEVKUXA5CNFSM4IL37D2KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4LZSQQ#issuecomment-521640258,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACWEWOHEM4QQP2R6QS433ULQEVKUXANCNFSM4IL37D2A
.

Final tag that can contain html doesn't need mj-raw at all.

Note that filePath option isn't tied to any output file, it's the base path where mj-include is applied

Hey @iRyusa is it possible to add the list of 'content' tags that dont parse (the mj-raw tag) to the docs @ https://mjml.io/documentation/#mj-raw?

Cause it seems like there's a few of us trying to use mjml in conjunction with template languages and expecting mj-raw to work globally.

Also see #1482 #1626

Common rules is any tag that receive anything other than MJML behave as a content tag

Was this page helpful?
0 / 5 - 0 ratings