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