Skip to content

Commit

Permalink
Update dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Aug 30, 2023
1 parent 3e2cf64 commit ce1740a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit ce1740a

Please sign in to comment.