Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rehype

Package Overview
Dependencies
Maintainers
2
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rehype - npm Package Compare versions

Comparing version 12.0.1 to 13.0.0

11

index.d.ts

@@ -1,6 +0,5 @@

export const rehype: import('unified').FrozenProcessor<
import('hast').Root,
import('hast').Root,
import('hast').Root,
string
>
/**
* Create a new unified processor that already uses `rehype-parse` and
* `rehype-stringify`.
*/
export const rehype: import("unified").Processor<import("hast").Root, undefined, undefined, import("hast").Root, string>;

@@ -1,5 +0,9 @@

import {unified} from 'unified'
import rehypeParse from 'rehype-parse'
import rehypeStringify from 'rehype-stringify'
import {unified} from 'unified'
/**
* Create a new unified processor that already uses `rehype-parse` and
* `rehype-stringify`.
*/
export const rehype = unified().use(rehypeParse).use(rehypeStringify).freeze()
{
"name": "rehype",
"version": "12.0.1",
"version": "13.0.0",
"description": "HTML processor powered by plugins part of the unified collective",
"license": "MIT",
"keywords": [
"unified",
"rehype",
"html",
"abstract",
"syntax",
"tree",
"ast",
"html",
"parse",
"process",
"rehype",
"serialize",
"stringify",
"serialize",
"process"
"syntax",
"tree",
"unified"
],
"dependencies": {
"@types/hast": "^2.0.0",
"rehype-parse": "^8.0.0",
"rehype-stringify": "^9.0.0",
"unified": "^10.0.0"
"@types/hast": "^3.0.0",
"rehype-parse": "^9.0.0",
"rehype-stringify": "^10.0.0",
"unified": "^11.0.0"
},

@@ -38,4 +38,3 @@ "homepage": "https://github.com/rehypejs/rehype",

"type": "module",
"main": "index.js",
"types": "index.d.ts",
"exports": "./index.js",
"files": [

@@ -45,5 +44,3 @@ "index.d.ts",

],
"scripts": {
"build": "rimraf \"*.d.ts\" && tsc && type-coverage"
},
"scripts": {},
"xo": false,

@@ -50,0 +47,0 @@ "typeCoverage": {

@@ -11,4 +11,4 @@ # rehype

**[unified][]** processor with support for parsing HTML input and serializing
HTML as output.
**[unified][]** processor to add support for parsing from HTML and serializing
to HTML.

@@ -36,3 +36,3 @@ ## Contents

This package is a [unified][] processor with support for parsing HTML input
This package is a [unified][] processor with support for parsing HTML as input
and serializing HTML as output by using unified with

@@ -63,3 +63,3 @@ [`rehype-parse`][rehype-parse] and [`rehype-stringify`][rehype-stringify].

This package is [ESM only][esm].
In Node.js (version 12.20+, 14.14+, or 16.0+), install with [npm][]:
In Node.js (version 16+), install with [npm][]:

@@ -70,13 +70,13 @@ ```sh

In Deno with [Skypack][]:
In Deno with [`esm.sh`][esmsh]:
```js
import {rehype} from 'https://cdn.skypack.dev/rehype@12?dts'
import {rehype} from 'https://esm.sh/rehype@13'
```
In browsers with [Skypack][]:
In browsers with [`esm.sh`][esmsh]:
```html
<script type="module">
import {rehype} from 'https://cdn.skypack.dev/rehype@12?min'
import {rehype} from 'https://esm.sh/rehype@13?bundle'
</script>

@@ -93,8 +93,3 @@ ```

main()
async function main() {
const file = await rehype()
.use(rehypeFormat)
.process(`<!doctype html>
const file = await rehype().use(rehypeFormat).process(`<!doctype html>
<html lang=en>

@@ -109,4 +104,3 @@ <head>

console.error(String(file))
}
console.error(String(file))
```

@@ -130,3 +124,3 @@

This package exports the following identifier: `rehype`.
This package exports the identifier [`rehype`][api-rehype].
There is no default export.

@@ -136,4 +130,6 @@

Create a new (unfrozen) unified processor that already uses `rehype-parse` and
`rehype-stringify` and you can add more plugins to.
Create a new unified processor that already uses
[`rehype-parse`][rehype-parse] and [`rehype-stringify`][rehype-stringify].
You can add more plugins with `use`.
See [`unified`][unified] for more information.

@@ -146,3 +142,3 @@

When you use `rehype-parse` or `rehype-stringify` manually you can pass options
to `use`.
directly to them with `use`.
Because both plugins are already used in `rehype`, that’s not possible.

@@ -152,15 +148,15 @@ To define options for them, you can instead pass options to `data`:

```js
import {rehype} from 'rehype'
import {reporter} from 'vfile-reporter'
import {rehype} from 'rehype'
main()
const file = await rehype()
.data('settings', {
emitParseErrors: true,
fragment: true,
preferUnquoted: true
})
.process('<div title="a" title="b"></div>')
async function main() {
const file = await rehype()
.data('settings', {fragment: true, emitParseErrors: true, preferUnquoted: true})
.process('<div title="a" title="b"></div>')
console.error(reporter(file))
console.log(String(file))
}
console.error(reporter(file))
console.log(String(file))
```

@@ -171,3 +167,3 @@

```txt
1:21-1:21 warning Unexpected duplicate attribute duplicate-attribute parse-error
1:21-1:21 warning Unexpected duplicate attribute duplicate-attribute hast-util-from-html

@@ -183,4 +179,4 @@ ⚠ 1 warning

HTML is parsed according to WHATWG HTML (the living standard), which is also
followed by browsers such as Chrome and Firefox.
HTML is parsed and serialized according to WHATWG HTML (the living standard),
which is also followed by all browsers.

@@ -194,11 +190,14 @@ ## Syntax tree

This package is fully typed with [TypeScript][].
There are no extra types exported.
It exports no additional types.
## Compatibility
Projects maintained by the unified collective are compatible with all maintained
Projects maintained by the unified collective are compatible with maintained
versions of Node.js.
As of now, that is Node.js 12.20+, 14.14+, and 16.0+.
Our projects sometimes work with older versions, but this is not guaranteed.
When we cut a new major release, we drop support for unmaintained versions of
Node.
This means we try to keep the current release line, `rehype@^13`, compatible
with Node.js 16.
## Security

@@ -229,4 +228,2 @@

<!--lint ignore no-html-->
<table>

@@ -280,2 +277,6 @@ <tr valign="middle">

<td width="10%" align="center">
<a href="https://markdown.space">Markdown Space</a><br><br>
<a href="https://markdown.space"><img src="https://images.opencollective.com/markdown-space/e1038ed/logo/128.png" width="64"></a>
</td>
<td width="10%" align="center">
<a href="https://www.holloway.com">Holloway</a><br><br>

@@ -286,3 +287,2 @@ <a href="https://www.holloway.com"><img src="https://avatars1.githubusercontent.com/u/35904294?s=128&v=4" width="64"></a>

<td width="10%"></td>
<td width="10%"></td>
</tr>

@@ -316,5 +316,5 @@ <tr valign="middle">

[size-badge]: https://img.shields.io/bundlephobia/minzip/rehype.svg
[size-badge]: https://img.shields.io/bundlejs/size/rehype
[size]: https://bundlephobia.com/result?p=rehype
[size]: https://bundlejs.com/?q=rehype

@@ -349,3 +349,3 @@ [sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg

[skypack]: https://www.skypack.dev
[esmsh]: https://esm.sh

@@ -371,1 +371,3 @@ [unified]: https://github.com/unifiedjs/unified

[rehype-dom]: https://github.com/rehypejs/rehype-dom/tree/main/packages/rehype-dom
[api-rehype]: #rehype-1
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