1 | 'use strict';
|
2 |
|
3 | var Promise = require('bluebird'),
|
4 | extend = require('extend'),
|
5 | inlineContent = require('./lib/inlineContent');
|
6 |
|
7 | module.exports = function (html, options) {
|
8 | return new Promise(function (resolve, reject) {
|
9 | var opt = extend({
|
10 | extraCss: '',
|
11 | applyStyleTags: true,
|
12 | removeStyleTags: true,
|
13 | applyLinkTags: true,
|
14 | removeLinkTags: true,
|
15 | preserveMediaQueries: false,
|
16 | removeHtmlSelectors: false,
|
17 | applyWidthAttributes: false,
|
18 | applyTableAttributes: false,
|
19 | xmlMode: false,
|
20 | decodeEntities: false,
|
21 | lowerCaseTags: true,
|
22 | lowerCaseAttributeNames: false,
|
23 | recognizeCDATA: false,
|
24 | recognizeSelfClosing: false
|
25 | }, options);
|
26 |
|
27 | inlineContent(html, opt)
|
28 | .then(function (data) {
|
29 | resolve(data);
|
30 | })
|
31 | .catch(function (err) {
|
32 | reject(err);
|
33 | });
|
34 | });
|
35 | };
|