mjml-parser-xml is a fundamental, internal package within the MJML ecosystem, currently at stable version 5.0.1. Its primary function is to parse MJML (Mailjet Markup Language) XML strings into an Abstract Syntax Tree (AST) or a similar structured JavaScript object representation. While this package is not typically accessed directly by end-users, who generally interact with the higher-level `mjml` package and its `mjml2html` function, it is a critical component that underpins the entire MJML conversion process. The parser translates MJML's declarative, semantic XML-like syntax into an intermediate format that the MJML engine can then process and render into robust, responsive HTML. The MJML project maintains an active and consistent development cadence, with frequent updates across its monorepo, including alpha and beta releases for major versions, ensuring ongoing compatibility with evolving email client standards and web practices.
npm install mjml-parser-xmlVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to import the `MJMLParser` and use it to convert a raw MJML string into its corresponding Abstract Syntax Tree (AST) object, illustrating basic parsing functionality and options.
Review all `mj-include` paths and ensure they are relative to the `filePath` option passed to the parser or are explicitly allowed. Use `mjml.config.js` for global configuration if applicable.
Adjust any tools or tests that depend on precise whitespace or formatting of the generated HTML. Minification options can be configured via `.mjmlconfig.js`.
Update any code or stylesheets that rely on the previous default `<body>` tag structure or its attributes. The `mj-body` component now controls its own `<body>` generation.
Avoid using `<` directly in `mj-raw` tags where it might be ambiguous. Consider using `<` for the less-than entity or reordering comparisons (e.g., `10 >= value;`) if possible.
Manually review and update older MJML templates to conform to MJML v4 or v5 syntax before upgrading. Consult the MJML v4 migration guide for guidance.
Ensure your development and deployment environments are running Node.js version 20 or higher.
Check for typos in MJML tag names. Ensure all custom components are correctly registered and available to the parser if using a custom setup.
Verify that the `filePath` option passed to `MJMLParser` is correct and that the included file path is relative and accessible within the allowed directories. Ensure no '..' escapes outside the `filePath` are used.
For ESM, use `import MJMLParser from 'mjml-parser-xml';`. For CommonJS, use `const MJMLParser = require('mjml-parser-xml');` and ensure your Node.js environment supports the module type being used.No dependency data recorded yet.