DefinitelyTyped/types/mjml/index.d.ts
Alex Seifert 7049fc4b4c
Add object type to the MJML package (#42066)
* Add object type to the MJML package

* Add more a more specific interface

* Add missing types to MJML and make optional ones optional

* Add usage examples to the MJML test file
2020-02-03 09:32:35 -08:00

39 lines
1.0 KiB
TypeScript

// Type definitions for mjml 4.0
// Project: https://github.com/mjmlio/mjml, https://mjml.io
// Definitions by: aahoughton <https://github.com/aahoughton>
// marpstar <https://github.com/marpstar>
// eiskalteschatten <https://github.com/eiskalteschatten>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface MJMLParsingOpts {
fonts?: { [key: string]: string; };
keepComments?: boolean;
beautify?: boolean;
minify?: boolean;
validationLevel?: 'strict' | 'soft' | 'skip';
filePath?: string;
}
interface MJMLParseError {
line: number;
message: string;
tagName: string;
formattedMessage: string;
}
interface MJMLParseResults {
html: string;
errors: MJMLParseError[];
}
interface MJMLJsonObject {
tagName: string;
attributes: object;
children?: MJMLJsonObject[];
content?: string;
}
declare function mjml2html(inp: string | MJMLJsonObject, opts?: MJMLParsingOpts): MJMLParseResults;
export = mjml2html;