UNPKG

946 BJavaScriptView Raw
1const inlineContent = require('./lib/inlineContent');
2
3module.exports = (html, options) => new Promise((resolve, reject) => {
4 const opt = Object.assign({}, {
5 extraCss: '',
6 applyStyleTags: true,
7 removeStyleTags: true,
8 applyLinkTags: true,
9 removeLinkTags: true,
10 preserveMediaQueries: false,
11 removeHtmlSelectors: false,
12 applyWidthAttributes: false,
13 applyTableAttributes: false,
14 codeBlocks: {
15 EJS: { start: '<%', end: '%>' },
16 HBS: { start: '{{', end: '}}' }
17 },
18 xmlMode: false,
19 decodeEntities: false,
20 lowerCaseTags: true,
21 lowerCaseAttributeNames: false,
22 recognizeCDATA: false,
23 recognizeSelfClosing: false
24 }, options);
25
26 inlineContent(String(html), opt)
27 .then(data => {
28 resolve(data);
29 })
30 .catch(err => {
31 reject(err);
32 });
33});