Skip to content

Commit ce1740a

Browse files
committed
Update dependency
1 parent 3e2cf64 commit ce1740a

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

lib/index.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,18 @@ const emptyOptions = {}
2727
*/
2828
export function toMdast(tree, options) {
2929
// We have to clone, cause we’ll use `rehype-minify-whitespace` on the tree,
30-
// which modifies
30+
// which modifies.
3131
const cleanTree = structuredClone(tree)
3232
const settings = options || emptyOptions
33+
const transformWhitespace = rehypeMinifyWhitespace({
34+
newlines: settings.newlines === true
35+
})
3336
const state = createState(settings)
3437
/** @type {MdastNodes} */
3538
let mdast
3639

37-
// To do: use `satisfies` in `rehype-minify-whitespace`
38-
// @ts-expect-error: does return a transformer, that does accept any node.
39-
rehypeMinifyWhitespace({newlines: settings.newlines === true})(cleanTree)
40+
// @ts-expect-error: fine to pass an arbitrary node.
41+
transformWhitespace(cleanTree)
4042

4143
visit(cleanTree, function (node) {
4244
if (node && node.type === 'element' && node.properties) {

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"mdast-util-phrasing": "^4.0.0",
4646
"mdast-util-to-hast": "^13.0.0",
4747
"mdast-util-to-string": "^4.0.0",
48-
"rehype-minify-whitespace": "^5.0.0",
48+
"rehype-minify-whitespace": "^6.0.0",
4949
"trim-trailing-lines": "^2.0.0",
5050
"unist-util-position": "^5.0.0",
5151
"unist-util-visit": "^5.0.0"

0 commit comments

Comments
 (0)