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

Rendering another MJML template in MJML template #2695

Open
returnv01d opened this issue Jun 22, 2023 · 4 comments
Open

Rendering another MJML template in MJML template #2695

returnv01d opened this issue Jun 22, 2023 · 4 comments

Comments

@returnv01d
Copy link

returnv01d commented Jun 22, 2023

Describe the bug
When MJML template contains in body another full MJML template (another <mjml>....</mjml>) then it does render only outer template (see screenshot) without throwing any errors.

To Reproduce
Steps to reproduce the behavior:

  1. Create a file with this MJML code:
<mjml>
  <mj-body background-color="#d2f1f6">
    <mj-section>
      <mj-column>
        <mj-text color="#F45E43">Hello World</mj-text>

      </mj-column>
    </mj-section>
    
    <mjml>
      <mj-body background-color="#F45E43">
        <mj-section>
          <mj-column>
            <mj-text>Test</mj-text>
          </mj-column>
        </mj-section>
      </mj-body>
    </mjml>
  </mj-body>
</mjml>
  1. Render it to HTML by doing 'mjml -r <path_to_file> --config.validationLevel strict`

Expected behavior
There should be at least error about illegal nesting or rendering both templates.

MJML environment (please complete the following information):

  • OS: MacOS
  • MJML Version 4.5.1
  • MJML tool used - local npm MJML

Screenshots
image

Additional context
Embedding MJML in layout uncovered this issue.

@iRyusa
Copy link
Member

iRyusa commented Jun 22, 2023

Why would you expect this to work ?

@returnv01d
Copy link
Author

I would expect it to throw an error, not to work

@iRyusa
Copy link
Member

iRyusa commented Jun 23, 2023

Ok then I misread, the issue first my bad.

Really weird that the validator doesn't catch this https://github.com/mjmlio/mjml/blob/master/packages/mjml-preset-core/src/dependencies.js#L8 this shouldn't be marked as a valid children 🤔

@returnv01d
Copy link
Author

I made a fix for this issue: #2709

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

Successfully merging a pull request may close this issue.

2 participants