Socket
Socket
Sign inDemoInstall

html-to-text

Package Overview
Dependencies
Maintainers
2
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-to-text - npm Package Compare versions

Comparing version 8.1.1 to 8.2.0

4

CHANGELOG.md
# 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 @@

6

lib/html-to-text.js

@@ -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>';

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc