html-to-text
Advanced tools
Comparing version 9.0.0-preview2 to 9.0.0
# Changelog | ||
## Version 9.0.0-preview2 (WIP) | ||
## Version 9.0.0 | ||
Fix deprecated `tags` option support. | ||
All commits: [8.2.1...9.0.0](https://github.com/html-to-text/node-html-to-text/compare/8.2.1...9.0.0) | ||
## Version 9.0.0-preview1 (WIP) | ||
Version 9 roadmap: [#240](https://github.com/html-to-text/node-html-to-text/issues/240) | ||
README location before full release: [v9/packages/html-to-text/README.md](https://github.com/html-to-text/node-html-to-text/blob/v9/packages/html-to-text/README.md) | ||
Request for comments: [#261 \[RFC\] Naming issue](https://github.com/html-to-text/node-html-to-text/discussions/261) - please take a look and share opinions while you're here | ||
All commits: [8.2.1...v9](https://github.com/html-to-text/node-html-to-text/compare/8.2.1...v9) | ||
Version 9 roadmap: [#240](https://github.com/html-to-text/node-html-to-text/issues/240) | ||
### Node version | ||
@@ -25,4 +21,6 @@ | ||
If you use CLI then install that package instead: _(WIP, to be provided before full release)_ | ||
If you use CLI then install [that package](https://github.com/html-to-text/node-html-to-text/tree/master/packages/html-to-text-cli/) instead. | ||
The new package uses new arg parser [aspargvs](https://github.com/mxxii/aspargvs) instead of minimist in order to deal with the vast options space of `html-to-text`. | ||
### Dependency updates | ||
@@ -40,3 +38,3 @@ | ||
Refer to README for [migration instructions](https://github.com/html-to-text/node-html-to-text#deprecated-or-removed-options). | ||
Refer to README for [migration instructions](https://github.com/html-to-text/node-html-to-text/tree/master/packages/html-to-text#deprecated-or-removed-options). | ||
@@ -50,2 +48,4 @@ ### New options | ||
New generic formatters `blockString`, `blockTag`, `blockHtml`, `inlineString`, `inlineSurround`, `inlineTag`, `inlineHtml` cover some common usage scenarios such as [#231](https://github.com/html-to-text/node-html-to-text/issues/231). | ||
### Changes to existing built-in formatters | ||
@@ -60,5 +60,10 @@ | ||
* `startNoWrap`, `stopNoWrap` - allows to keep local inline content in a single line regardless of wrapping options; | ||
* `addLiteral` - it's like `addInline` but circumvents most of the text processing logic. This should be preferred when inserting markup elements; | ||
* `addLiteral` - it is like `addInline` but circumvents most of the text processing logic. This should be preferred when inserting markup elements; | ||
* It is now possible to provide a metadata object along with the HTML string to convert. Metadata object is available for custom formatters via `builder.metadata`. This allows to compile the converter once and still being able to supply per-document data. Metadata object is supplied as the last optional argument to `convert` function and the function returned by `compile` function. | ||
### Other | ||
* Fix deprecated `tags` option support. Addresses [#253](https://github.com/html-to-text/node-html-to-text/issues/253). | ||
---- | ||
@@ -65,0 +70,0 @@ |
{ | ||
"name": "html-to-text", | ||
"version": "9.0.0-preview2", | ||
"version": "9.0.0", | ||
"description": "Advanced html to plain text converter", | ||
@@ -44,15 +44,13 @@ "keywords": [ | ||
"build:rollup": "rollup -c", | ||
"build": "npm run clean && npm run build:rollup", | ||
"build": "npm run clean && npm run build:rollup && npm run copy:license", | ||
"clean": "rimraf lib", | ||
"copy:license": "copyfiles -f ../../LICENSE .", | ||
"cover": "c8 --reporter=lcov --reporter=text-summary mocha -t 20000", | ||
"lint": "eslint ../../", | ||
"prepublishOnly": "npm run copy:license && npm run lint && npm test", | ||
"test": "mocha" | ||
}, | ||
"dependencies": { | ||
"@selderee/plugin-htmlparser2": "^0.9.0", | ||
"@selderee/plugin-htmlparser2": "^0.10.0", | ||
"deepmerge": "^4.2.2", | ||
"htmlparser2": "^8.0.1", | ||
"selderee": "^0.9.0" | ||
"selderee": "^0.10.0" | ||
}, | ||
@@ -59,0 +57,0 @@ "mocha": { |
@@ -5,3 +5,3 @@ # html-to-text | ||
[![test status](https://github.com/html-to-text/node-html-to-text/workflows/test/badge.svg)](https://github.com/html-to-text/node-html-to-text/actions/workflows/test.yml) | ||
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/html-to-text/node-html-to-text/blob/master/LICENSE-MIT) | ||
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/html-to-text/node-html-to-text/blob/master/LICENSE) | ||
[![npm](https://img.shields.io/npm/v/html-to-text?logo=npm)](https://www.npmjs.com/package/html-to-text) | ||
@@ -23,3 +23,3 @@ [![npm](https://img.shields.io/npm/dw/html-to-text?color=informational&logo=npm)](https://www.npmjs.com/package/html-to-text) | ||
~~Available here: [CHANGELOG.md](https://github.com/html-to-text/node-html-to-text/blob/master/CHANGELOG.md)~~ | ||
Available here: [CHANGELOG.md](https://github.com/html-to-text/node-html-to-text/blob/master/packages/html-to-text/CHANGELOG.md) | ||
@@ -32,6 +32,4 @@ Version 6 contains a ton of changes, so it worth to take a look at the full changelog. | ||
Version 9 gets a significant internal rework, drops a lot of previously deprecated options, introduces some new formatters and new capabilities for custom formatters. | ||
Version 9 drops a lot of previously deprecated options, introduces some new formatters and new capabilities for custom formatters. Now a dual-mode package (cjs and esm). CLI is moved to a [separate package](https://github.com/html-to-text/node-html-to-text/tree/master/packages/html-to-text-cli/). | ||
Version 9 WIP [GitHub branch](https://github.com/html-to-text/node-html-to-text/tree/v9), [CHANGELOG.md](https://github.com/html-to-text/node-html-to-text/blob/v9/packages/html-to-text/CHANGELOG.md). | ||
## Installation | ||
@@ -111,3 +109,3 @@ | ||
`baseElement` | 8.0 | | `baseElements: { selectors: [ 'body' ] }` | ||
`decodeOptions` | | 9.0 | Entity decoding is now handled by [htmlparser2](https://github.com/fb55/htmlparser2) itself and [entities](https://github.com/fb55/entities) internally. No user-configurable parts compared to [he](https://github.com/mathiasbynens/he). | ||
`decodeOptions` | | 9.0 | Entity decoding is now handled by [htmlparser2](https://github.com/fb55/htmlparser2) itself and [entities](https://github.com/fb55/entities) internally. No user-configurable parts compared to [he](https://github.com/mathiasbynens/he) besides boolean `decodeEntities`. | ||
`format` | | 6.0 | The way formatters are written has changed completely. New formatters have to be added to the `formatters` option, old ones can not be reused without rewrite. See [new instructions](#override-formatting) below. | ||
@@ -245,2 +243,5 @@ `hideLinkHrefIfSameAsText` | 6.0 | 9.0 | `selectors: [ { selector: 'a', options: { hideLinkHrefIfSameAsText: true } } ]` | ||
`rowSpacing` | `0` | `dataTable` | Number of empty lines between data table rows. | ||
`string` | `''` | `blockString`, `inlineString` | A string to be inserted in place of a tag. | ||
`prefix` | `''` | `inlineSurround` | String prefix to be inserted before inline tag contents. | ||
`suffix` | `''` | `inlineSurround` | String suffix to be inserted after inline tag contents. | ||
@@ -261,3 +262,3 @@ ##### Deprecated format options | ||
* `walk` - recursive function to process the children of this element. Called as `walk(elem.children, builder)`; | ||
* `builder` - [BlockTextBuilder](https://github.com/html-to-text/node-html-to-text/blob/master/lib/block-text-builder.js) object. Manipulate this object state to build the output text; | ||
* `builder` - [BlockTextBuilder](https://github.com/html-to-text/node-html-to-text/blob/master/packages/base/src/block-text-builder.js) object. Manipulate this object state to build the output text; | ||
* `formatOptions` - options that are specified for a tag, along with this formatter (Note: if you need general html-to-text [options](#general-options) - they are accessible via `builder.options`). | ||
@@ -295,10 +296,10 @@ | ||
Refer to [built-in formatters](https://github.com/html-to-text/node-html-to-text/blob/master/lib/formatter.js) for more examples. The easiest way to write your own is to pick an existing one and customize. | ||
Refer to [generic formatters](https://github.com/html-to-text/node-html-to-text/blob/master/packages/base/src/formatter.js) of the base package and [text formatters](https://github.com/html-to-text/node-html-to-text/blob/master/packages/html-to-text/src/text-formatters.js) of this package for more examples. The easiest way to write your own is to pick an existing one and customize. | ||
Refer to [BlockTextBuilder](https://github.com/html-to-text/node-html-to-text/blob/master/lib/block-text-builder.js) for available functions and arguments. | ||
Refer to [BlockTextBuilder](https://github.com/html-to-text/node-html-to-text/blob/master/packages/base/src/block-text-builder.js) for available functions and arguments. | ||
## Example | ||
* Input text: [test.html](https://github.com/html-to-text/node-html-to-text/blob/master/test/test.html) | ||
* Output text: [test.txt](https://github.com/html-to-text/node-html-to-text/blob/master/test/test.txt) | ||
* Input text: [test.html](https://github.com/html-to-text/node-html-to-text/blob/master/packages/html-to-text/test/test.html) | ||
* Output text: [test.txt](https://github.com/html-to-text/node-html-to-text/blob/master/packages/html-to-text/test/test.txt) | ||
@@ -313,2 +314,2 @@ ## Contributors | ||
[MIT License](https://github.com/html-to-text/node-html-to-text/blob/master/LICENSE-MIT) | ||
[MIT License](https://github.com/html-to-text/node-html-to-text/blob/master/LICENSE) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
167648
0
0
308
+ Added@selderee/plugin-htmlparser2@0.10.0(transitive)
+ Addedleac@0.6.0(transitive)
+ Addedparseley@0.11.0(transitive)
+ Addedpeberminta@0.8.0(transitive)
+ Addedselderee@0.10.0(transitive)
- Removed@selderee/plugin-htmlparser2@0.9.0(transitive)
- Removeddomhandler@4.3.1(transitive)
- Removedleac@0.5.1(transitive)
- Removedparseley@0.10.0(transitive)
- Removedpeberminta@0.6.0(transitive)
- Removedselderee@0.9.0(transitive)
Updatedselderee@^0.10.0