Skip to content

Commit

Permalink
Add support for passing options to hast-util-raw
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Mar 5, 2021
1 parent 6c0e837 commit a3f37ce
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
11 changes: 7 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
'use strict'

var util = require('hast-util-raw')
var hastUtilRaw = require('hast-util-raw')

module.exports = raw
module.exports = rehypeRaw

function raw() {
return util
function rehypeRaw(options) {
return transform
function transform(tree, file) {
return hastUtilRaw(tree, file, options)
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"types/index.d.ts"
],
"dependencies": {
"hast-util-raw": "^6.0.0"
"hast-util-raw": "^6.1.0"
},
"devDependencies": {
"browserify": "^17.0.0",
Expand Down
3 changes: 2 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,11 @@ example.md: no issues found

## API

### `rehype().use(raw)`
### `rehype().use(raw[, options])`

Parse the tree again, also parsing “raw” nodes (as exposed by
[`remark-rehype`][remark-rehype]).
`options` are passed to [hast-util-raw][raw].

###### Note

Expand Down
3 changes: 2 additions & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// TypeScript Version: 3.4

import {Plugin} from 'unified'
import {Options} from 'hast-util-raw'

declare const rehypeRaw: Plugin<[]>
declare const rehypeRaw: Plugin<[Options?]>

export = rehypeRaw
1 change: 1 addition & 0 deletions types/rehype-raw-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ import unified = require('unified')
import raw = require('rehype-raw')

unified().use(raw)
unified().use(raw, {passThrough: []})

0 comments on commit a3f37ce

Please sign in to comment.