timo-reymann / intellij-mjml-support

MJML support for the IntelliJ Platform.
https://timo-reymann.github.io/intellij-mjml-support/
Other
26 stars 11 forks source link

MJ-RAW is encoding HTML tags (<>) when generating HTML from within IntelliJ plug-in (PHPStorm) #196

Closed chrisconverse closed 8 months ago

chrisconverse commented 8 months ago

What happened?

The greater than and less than characters are being encoded when wrapped in the mj-raw tags.

OS

Darwin

What IDE are you facing the problem in?

PhpStorm

Problem description

I am trying to pass pass in a variable set by my organization to handle unsubscribe links <mj-raw><%@ include view=‘ORGUnsubscribeLink’ %></mj-raw>

Expected behaviour

I expect the tag to be replaced with the HTML code inside: <%@ include view=‘ORGUnsubscribeLink’ %>

Actual behaviour

The tags appear in the final HTML, and the HTML code inside the mj-raw is encoded, Below is what appears in the HTML: <mj-raw>&lt;%@ include view=&#x2018;ORGUnsubscriptionLink&#x2019; %&gt;</mj-raw>

Steps to Reproduce

Add the following code to an MJML document, then check the HTML preview: <mj-raw><%@ include view=‘ORGUnsubscribeLink’ %></mj-raw>

Turns into the following: <mj-raw>&lt;%@ include view=&#x2018;ORGUnsubscriptionLink&#x2019; %&gt;</mj-raw>

Important Factoids

No response

References

No response

I read and aggree to the contribution guidelines

timo-reymann commented 8 months ago

The plugin and the built-in renderer does not support template languages.

There is only user contributed detection of MJML files when they match *_mjml.blade.php and I do not plan to support any template languages by default.

What you can do is creating a custom renderer script that suits your needs - in this case adds the template include to the HTML before rendering with MJML.

For more information check the tutorial on the plugin page: https://plugins.jetbrains.com/plugin/16418-mjml-support/tutorials/custom-rendering-script