Skip to content

Commit

Permalink
Update hast-util-raw, @types/hast
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Aug 26, 2023
1 parent a0a784e commit cdbb980
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
8 changes: 6 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
/**
* @typedef {import('hast').Root} Root
* @typedef {import('hast-util-raw').Options} Options
* @typedef {import('hast-util-raw').Options} RawOptions
* @typedef {import('hast-util-raw')} DoNotTouchAsThisImportIncludesRawInTree
*/

/**
* @typedef {Omit<RawOptions, 'file'>} Options
*/

import {raw} from 'hast-util-raw'

/**
Expand All @@ -15,7 +19,7 @@ import {raw} from 'hast-util-raw'
export default function rehypeRaw(options = {}) {
return (tree, file) => {
// Assume that when a root was given, it’s also returned.
const result = /** @type {Root} */ (raw(tree, file, options))
const result = /** @type {Root} */ (raw(tree, {...options, file}))
return result
}
}
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,23 @@
"index.js"
],
"dependencies": {
"@types/hast": "^2.0.0",
"hast-util-raw": "^7.2.0",
"unified": "^10.0.0"
"@types/hast": "^3.0.0",
"hast-util-raw": "^9.0.0",
"unified": "^11.0.0"
},
"devDependencies": {
"@types/node": "^20.0.0",
"c8": "^8.0.0",
"prettier": "^3.0.0",
"rehype-stringify": "^9.0.0",
"rehype-stringify": "^10.0.0",
"remark-cli": "^11.0.0",
"remark-parse": "^10.0.0",
"remark-preset-wooorm": "^9.0.0",
"remark-rehype": "^10.0.0",
"rimraf": "^3.0.0",
"type-coverage": "^2.0.0",
"typescript": "^5.0.0",
"unist-util-visit": "^4.0.0",
"unist-util-visit": "^5.0.0",
"xo": "^0.56.0"
},
"scripts": {
Expand Down
2 changes: 2 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ const html = `<div class="note">

test('rehypeRaw', async () => {
const file = await unified()
// @ts-expect-error: to do: remove when remark is released.
.use(remarkParse)
// @ts-expect-error: to do: remove when remark-rehype is released.
.use(remarkRehype, {allowDangerousHtml: true})
.use(rehypeRaw)
.use(
Expand Down

0 comments on commit cdbb980

Please sign in to comment.