rehype-dom-parse
Advanced tools
Comparing version
{ | ||
"name": "rehype-dom-parse", | ||
"version": "3.0.0", | ||
"version": "4.0.0", | ||
"description": "rehype plugin to use browser APIs to parse HTML", | ||
@@ -25,10 +25,27 @@ "license": "ISC", | ||
], | ||
"main": "dist/rehype-dom-parse.js", | ||
"module": "dist/rehype-dom-parse.mjs", | ||
"sideEffects": false, | ||
"type": "module", | ||
"main": "index.js", | ||
"types": "index.d.ts", | ||
"files": [ | ||
"dist" | ||
"lib/", | ||
"index.d.ts", | ||
"index.js" | ||
], | ||
"dependencies": { | ||
"hast-util-from-dom": "^3.0.0" | ||
"@types/hast": "^2.0.0", | ||
"@types/web": "^0.0.12", | ||
"hast-util-from-dom": "^4.0.0", | ||
"unified": "^10.0.0" | ||
}, | ||
"scripts": { | ||
"build": "rimraf \"lib/*.d.ts\" && tsc && type-coverage" | ||
}, | ||
"xo": false, | ||
"typeCoverage": { | ||
"atLeast": 100, | ||
"detail": true, | ||
"strict": true, | ||
"ignoreCatch": true | ||
} | ||
} |
@@ -25,8 +25,5 @@ # rehype-dom-parse | ||
[yarn][]: | ||
This package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c): | ||
Node 12+ is needed to use it and it must be `import`ed instead of `require`d. | ||
```sh | ||
yarn add rehype-dom-parse | ||
``` | ||
[npm][]: | ||
@@ -41,19 +38,14 @@ | ||
```js | ||
import unified from 'unified'; | ||
import createStream from 'unified-stream'; | ||
import parse from 'rehype-dom-parse'; | ||
import stringify 'rehype-dom-stringify'; | ||
import {unified} from 'unified' | ||
import rehypeDomParse from 'rehype-dom-parse' | ||
import rehypeDomStringify from 'rehype-dom-stringify' | ||
const processor = unified() | ||
.use(parse) | ||
.use(stringify) | ||
.data('settings', { fragment: true }) | ||
unified() | ||
.use(rehypeDomParse) | ||
.use(rehypeDomStringify) | ||
.data('settings', {fragment: true}) | ||
processor.process('<p>text, <b>hyper', (err, file) => { | ||
if (err) { | ||
console.error(err); | ||
} else { | ||
console.log(String(file)); | ||
} | ||
}); | ||
processor.process('<p>text, <b>hyper').then((file) => { | ||
console.log(String(file)) | ||
}) | ||
``` | ||
@@ -69,5 +61,8 @@ | ||
### `processor.use(parse[, options])` | ||
This package exports no identifiers. | ||
The default export is `rehypeDomParse`. | ||
Configure `processor` to parse HTML as input and transform it to | ||
### `unified.use(rehypeDomParse[, options])` | ||
Configure a processor to parse HTML as input and transform it to | ||
[**hast**][hast]. | ||
@@ -106,5 +101,5 @@ | ||
[build-badge]: https://img.shields.io/travis/rehypejs/rehype-dom.svg | ||
[build-badge]: https://github.com/rehypejs/rehype-dom/workflows/main/badge.svg | ||
[build]: https://travis-ci.org/rehypejs/rehype-dom | ||
[build]: https://github.com/rehypejs/rehype-dom/actions | ||
@@ -129,8 +124,6 @@ [coverage-badge]: https://img.shields.io/codecov/c/github/rehypejs/rehype-dom.svg | ||
[chat-badge]: https://img.shields.io/badge/join%20the%20community-on%20spectrum-7b16ff.svg | ||
[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg | ||
[chat]: https://spectrum.chat/unified/rehype | ||
[chat]: https://github.com/rehypejs/rehype/discussions | ||
[yarn]: https://yarnpkg.com/lang/en/docs/install | ||
[npm]: https://docs.npmjs.com/cli/install | ||
@@ -137,0 +130,0 @@ |
7713
13.98%6
50%70
37.25%Yes
NaN4
300%153
-4.37%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated