-
Notifications
You must be signed in to change notification settings - Fork 967
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
mjml --validate not working properly #1356
Comments
Wait, so header.mjml is just an include right ? With no mj-head & body ? |
yes. |
So that's why we can't really validate a include without the context of where it's included. The validator already validate nested include so that's the reason why it doesn't output anything. Edit: note that include can be described as a full MJML document. Main issue would be if it doesn't start with a mj-section it will trigger an error on validation whereas it can be totally used in a document |
I'm not sure I totally understand your last post, but if I try to run the validator against although, it should. Steps to reproduce:
Create another file
there are two errors in this file:
Both commands below return no error:
If I modify Content
Output:
But still no output for What's even worse (for me) is that I get no error on the unclosed MJML tag. |
I'm almost sure either you have a conflict issue with an old MJML version or somewhat, it works just fine |
About the unclosed tag, there's no way to identify those for now with the current parser implem. And I'm not sure that we would be able to identify it anyway, because you're closing the parent tag (mj-column) here. |
The current parser here is raising a warning (not an error): https://mjml.io/try-it-live/BJuqJtIFQ |
Well the issue is on the try it live we're using a basic XML parser from CodeMirror that just tells you when an XML document isn't valid so it's not really related to MJML. |
between your implementation above and mine there are two differences:
I'll give it a try as you suggested, to see if it happens. can you also share with me your environment setup? npm version, yarn version etc. ? or, preferably, a docker file I can use? |
yarn/npm doesn't mean much here, yarn just allow a shortcut to run binary, would be the same to you
And it does exactly the same here with subfolder.
I'm using node 9.5, but don't see any difference from TLS, to this one. Do you install MJML globally ? If yes, please clean it, remove every mjml-related package and do a full reinstall. Are you on Windows ? Does the included file is well replaced on build ? If you don't use the cli to build it, do you modify the |
Well, as mentioned, it works just fine for us, non-closed tags are really hard to identify. I wonder if parser can detect if a tag is properly closed (cc @kmcb777, could be a new rule to add for 4.3 ?) It looks most likely like an env issue from you. Feel free to reopen if you have more information to share |
I'm trying to setup a repository for our newsletters with a build system in place that ensures no developer is committing malformed MJML code.
This build system should run
mjml --validate files/*
and fail if any of the files in that repo have typos or illegal attributes.As I have mentioned in several comments in #198 this is not happening. I guess I found a way to reproduce this, somehow, consistently.
Reproduction Steps:
I have the file
header.mjml
with the following code:If I change the mjml-image this to:
and I run the command
node_modules/.bin/mjml --validate mjml/includes/header.mjml
I get no output in the console.same behavior if I change the code to the following:
<mj-section padding="0"> <mj-column padding-top="30px"> + <mj-image width="203px" src="images/logo.png" align="center" padding="0" href="https://bestvalue.eu" target="_blank" illegal="attribute" /> <mj-image width="203px" src="images/logo.png" align="center" padding="0" href="https://bestvalue.eu" target="_blank" /> </mj-column> </mj-section>
the strange thing is that if I run the same command over the file having only the content below:
I get the expected error in console:
Expected behavior:
node_modules/.bin/mjml --validate mjml/includes/header.mjml
should always fail when I have the following code in the file:Observed behavior:
Sometimes, the wrong code does not trigger a validation error.
MJML version:
Email clients the bug is seen on:
N/A
The text was updated successfully, but these errors were encountered: