Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should render a mjml chart', () => {
expect(
mjml2html(`
`).html
).to.contain(
''
);
});
html: (activationToken: string) =>
mjml2html(`
${header}
Activation du compte
Cliquez sur le lien ci-dessous pour activer votre compte sur Emendare:
Activer mon compte
L'équipe d'Emendare
${footer}
export default function mjmlRenderer(template) {
const { html, errors } = mjml2html(htmlReactRenderer(template))
if (errors.length > 0) throw new Error(errors.map(e => e.formattedMessage).join('\n'))
return html
}
renderMJML(TextEditor, done) {
const mjmlTempPath = path.resolve(path.join(os.tmpdir(), `${TextEditor.getTitle()}.html`))
const outputHTML = mjml2html(TextEditor.getText(), { level: 'skip', disableMinify: true, filePath: TextEditor.getPath() }).html
fs.writeFile(mjmlTempPath, outputHTML, (err) => {
if (err) {
throw err
}
done(mjmlTempPath)
})
}
getHtml() {
const { errors, html } = mjml2html(this.render());
if (__DEV__) {
if (errors && errors.length) {
this.log.error('Template.getHtml mjml', errors);
}
}
return html;
}
function render(email, options = {}) {
const defaults = {
keepComments: false,
beautify: false,
minify: true,
validationLevel: 'strict'
};
return mjml2html(renderToMjml(email), {...defaults, ...options});
}
export function mjmlToHtml(
mjml: string, minify: boolean, beautify: boolean, path?: string, validation: "strict" | "soft" | "skip" = "skip"
): { html: string, errors: any[] } {
try {
if (!path) {
path = getPath();
}
return mjml2html(mjml, {
beautify,
filePath: path,
minify,
mjmlConfigPath: getCWD(path),
validationLevel: validation
});
} catch (error) {
return { html: "", errors: [error] };
}
}
function pendingEmail({ user, org }) {
return mjml2html(`
Your request to join ${org.name} has been approved.
Head over to <a href="https://lume.space/cms/${
org.subdomain
}">your organization's home</a> to start working on a story now!