-
Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathindex.js
More file actions
37 lines (34 loc) · 1.08 KB
/
index.js
File metadata and controls
37 lines (34 loc) · 1.08 KB
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
34
35
36
37
'use strict';
var Promise = require('bluebird'),
extend = require('extend'),
inlineContent = require('./lib/inlineContent');
module.exports = function (html, options) {
return new Promise(function (resolve, reject) {
var opt = extend({
extraCss: '',
applyStyleTags: true,
removeStyleTags: true,
applyLinkTags: true,
removeLinkTags: true,
preserveMediaQueries: false,
removeHtmlSelectors: false,
applyWidthAttributes: false,
applyHeightAttributes: false,
applyCenterAttributes: false,
applyTableAttributes: false,
xmlMode: false,
decodeEntities: false,
lowerCaseTags: true,
lowerCaseAttributeNames: false,
recognizeCDATA: false,
recognizeSelfClosing: false
}, options);
inlineContent(html, opt)
.then(function (data) {
resolve(data);
})
.catch(function (err) {
reject(err);
});
});
};