Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
mjml-validator
Advanced tools
MJML provides a validation layer that helps you building your email. It can detect if you misplaced or mispelled a MJML component, or if you used any unauthorised attribute on a specific component. It supports 3 levels of validation:
By default, the level is set to soft
.
When using the mjml
command line, you can add the option -l
or --level
with the validation level you want.
Validates the file without rendering it
$> mjml --validate template.mjml
Sets the validation level to
skip
(so that the file is not validated) and renders the file
$> mjml -l skip -r template.mjml
In Javascript, you can provide the level through the options
parameters on MJMLRenderer
. Ex: new MJMLRenderer(inputMJML, { level: strict })
strict
will raise a MJMLValidationError
exception. This object has 2 methods:
getErrors
returns an array of objects with line
, message
, tagName
as well as a formattedMessage
which contains the line
, message
and tagName
concatenated in a sentence.getMessages
returns an array of formattedMessage
.When using soft
, no exception will be raised. You can get the errors using the object returned by the render
method errors
. It is the same object returned by getErrors
on strict mode.
If not exists, add a .mjmlconfig file at the root of your project (where you execute the mjml command).
Add the following key to the json:
{
...
"validators": [
"validateTag",
"validateAttribute",
"validChildren",
"./validators/ColumnCount.js",
]
}
"validateTag", "validateAttribute" and "validChildren" are the default validation rules. If you want to add custom rules, you can add the path to the file where the validtion function resides.
FAQs
mjml-validator
The npm package mjml-validator receives a total of 543,332 weekly downloads. As such, mjml-validator popularity was classified as popular.
We found that mjml-validator demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.