Skip to content

Commit

Permalink
chore: upgrade html-to-text and its usage (closes #437)
Browse files Browse the repository at this point in the history
  • Loading branch information
niftylettuce committed Mar 20, 2022
1 parent 1d6f1e7 commit a07f587
Show file tree
Hide file tree
Showing 3 changed files with 210 additions and 210 deletions.
12 changes: 6 additions & 6 deletions package.json
Expand Up @@ -18,31 +18,31 @@
"dependencies": {
"@ladjs/i18n": "^7.2.6",
"consolidate": "^0.16.0",
"debug": "^4.3.3",
"debug": "^4.3.4",
"get-paths": "^0.0.7",
"html-to-text": "^6.0.0",
"html-to-text": "^8.1.0",
"juice": "^7.0.0",
"lodash": "^4.17.21",
"nodemailer": "^6.7.2",
"preview-email": "^3.0.5"
},
"devDependencies": {
"@babel/cli": "^7.17.6",
"@babel/core": "^7.17.5",
"@babel/core": "^7.17.8",
"@babel/preset-env": "^7.16.11",
"@commitlint/cli": "^16.2.1",
"@commitlint/cli": "^16.2.3",
"@commitlint/config-conventional": "^16.2.1",
"ava": "^4.1.0",
"cheerio": "^1.0.0-rc.10",
"codecov": "^3.8.3",
"cross-env": "^7.0.3",
"ejs": "^3.1.6",
"eslint": "^8.10.0",
"eslint": "^8.11.0",
"eslint-config-xo-lass": "^1.0.6",
"eslint-plugin-node": "^11.1.0",
"fixpack": "^4.0.0",
"husky": "^7.0.4",
"lint-staged": "^12.3.5",
"lint-staged": "^12.3.7",
"nodemailer-sendgrid": "^1.0.3",
"nyc": "^15.1.0",
"pug": "^3.0.2",
Expand Down
12 changes: 5 additions & 7 deletions src/index.js
Expand Up @@ -8,7 +8,7 @@ const _ = require('lodash');
const consolidate = require('consolidate');
const debug = require('debug')('email-templates');
const getPaths = require('get-paths');
const htmlToText = require('html-to-text');
const { convert } = require('html-to-text');
const juice = require('juice');
const nodemailer = require('nodemailer');
const previewEmail = require('preview-email');
Expand Down Expand Up @@ -80,9 +80,9 @@ class Email {
customRender: false,
// force text-only rendering of template (disregards template folder)
textOnly: false,
// <https://github.com/werk85/node-html-to-text>
// <https://github.com/html-to-text/node-html-to-text>
htmlToText: {
ignoreImage: true
selectors: [{ selector: 'img', format: 'skip' }]
},
subjectPrefix: false,
// <https://github.com/Automattic/juice>
Expand Down Expand Up @@ -280,10 +280,8 @@ class Email {
// we'd use nodemailer-html-to-text plugin
// but we really don't need to support cid
// <https://github.com/andris9/nodemailer-html-to-text>
message.text = htmlToText.fromString(
message.html,
this.config.htmlToText
);
// (and it is also not updated with latest html-to-text)
message.text = convert(message.html, this.config.htmlToText);

// if we only want a text-based version of the email
if (this.config.textOnly) delete message.html;
Expand Down

0 comments on commit a07f587

Please sign in to comment.