You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.js 946B

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