From 3e2cf64e6726b7e41ca7d9e473e01533f9852dc1 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Wed, 30 Aug 2023 17:31:16 +0200 Subject: [PATCH 1/3] Update dev-dependencies --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 40777b8..168dceb 100644 --- a/package.json +++ b/package.json @@ -69,7 +69,7 @@ "typescript": "^5.0.0", "unist-builder": "^4.0.0", "unist-util-remove-position": "^5.0.0", - "xo": "^0.55.0" + "xo": "^0.56.0" }, "scripts": { "prepack": "npm run build && npm run format", From ce1740aac4d7b109d911522a6616b2ce066be5a0 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Wed, 30 Aug 2023 17:31:19 +0200 Subject: [PATCH 2/3] Update dependency --- lib/index.js | 10 ++++++---- package.json | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/index.js b/lib/index.js index 68826d9..98c281d 100644 --- a/lib/index.js +++ b/lib/index.js @@ -27,16 +27,18 @@ const emptyOptions = {} */ export function toMdast(tree, options) { // We have to clone, cause we’ll use `rehype-minify-whitespace` on the tree, - // which modifies + // which modifies. const cleanTree = structuredClone(tree) const settings = options || emptyOptions + const transformWhitespace = rehypeMinifyWhitespace({ + newlines: settings.newlines === true + }) const state = createState(settings) /** @type {MdastNodes} */ let mdast - // To do: use `satisfies` in `rehype-minify-whitespace` - // @ts-expect-error: does return a transformer, that does accept any node. - rehypeMinifyWhitespace({newlines: settings.newlines === true})(cleanTree) + // @ts-expect-error: fine to pass an arbitrary node. + transformWhitespace(cleanTree) visit(cleanTree, function (node) { if (node && node.type === 'element' && node.properties) { diff --git a/package.json b/package.json index 168dceb..81e86fc 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "mdast-util-phrasing": "^4.0.0", "mdast-util-to-hast": "^13.0.0", "mdast-util-to-string": "^4.0.0", - "rehype-minify-whitespace": "^5.0.0", + "rehype-minify-whitespace": "^6.0.0", "trim-trailing-lines": "^2.0.0", "unist-util-position": "^5.0.0", "unist-util-visit": "^5.0.0" From 7be4e814ae749b51c4ccd7b607706dbe3fd82cb2 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Wed, 30 Aug 2023 17:31:36 +0200 Subject: [PATCH 3/3] 10.0.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 81e86fc..ec3a116 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hast-util-to-mdast", - "version": "10.0.0", + "version": "10.0.1", "description": "hast utility to transform to mdast", "license": "MIT", "keywords": [