html-to-text
Advanced tools
Comparing version 8.1.1 to 8.2.0
# Changelog | ||
## Version 8.2.0 | ||
Fix for the issue [#249](https://github.com/html-to-text/node-html-to-text/issues/249) and possibly other obscure issues when some selector options are ignored. `options.selectors` array was not fully processed before. | ||
## Version 8.1.1 | ||
@@ -4,0 +8,0 @@ |
@@ -147,7 +147,7 @@ const { hp2Builder } = require('@selderee/plugin-htmlparser2'); | ||
options.formatters = Object.assign({}, defaultFormatters, options.formatters); | ||
options.selectors = mergeDuplicatesPreferLast(options.selectors, (s => s.selector)); | ||
handleDeprecatedOptions(options); | ||
const uniqueSelectors = mergeDuplicatesPreferLast(options.selectors, (s => s.selector)); | ||
const selectorsWithoutFormat = uniqueSelectors.filter(s => !s.format); | ||
const selectorsWithoutFormat = options.selectors.filter(s => !s.format); | ||
if (selectorsWithoutFormat.length) { | ||
@@ -160,3 +160,3 @@ throw new Error( | ||
const picker = new selderee.DecisionTree( | ||
uniqueSelectors.map(s => [s.selector, s]) | ||
options.selectors.map(s => [s.selector, s]) | ||
).build(hp2Builder); | ||
@@ -163,0 +163,0 @@ |
{ | ||
"name": "html-to-text", | ||
"version": "8.1.1", | ||
"version": "8.2.0", | ||
"description": "Advanced html to plain text converter", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -274,2 +274,13 @@ | ||
it('should return link without brackets if noLinkBrackets is set to true (deprecated option)', function () { | ||
const html = '<a href="http://my.link">test</a>'; | ||
const expected = 'test http://my.link'; | ||
const options = { | ||
selectors: [ | ||
{ selector: 'a', options: { noLinkBrackets: true } } | ||
] | ||
}; | ||
expect(htmlToText(html, options)).to.equal(expected); | ||
}); | ||
it('should return link without brackets if linkBrackets is set to false', function () { | ||
@@ -276,0 +287,0 @@ const html = '<a href="http://my.link">test</a>'; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
197994
3666