Skip to content

Commit

Permalink
Update @types/mdast, unified, utilities
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Sep 18, 2023
1 parent c223cd8 commit a952370
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
15 changes: 6 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
/// <reference types="remark-parse" />
/// <reference types="remark-stringify" />

/**
* @typedef {import('mdast').Root} Root
* @typedef {import('mdast-util-directive')} DoNotTouchAsThisImportIncludesDirectivesInTree
* @typedef {import('unified').Processor<Root>} Processor
*/

import {directive} from 'micromark-extension-directive'
import {directiveFromMarkdown, directiveToMarkdown} from 'mdast-util-directive'
import {directive} from 'micromark-extension-directive'

/**
* Add support for generic directives.
Expand All @@ -23,20 +26,14 @@ export default function remarkDirective() {
const self = /** @type {Processor} */ (this)
const data = self.data()

/** @type {Array<unknown>} */
// @ts-expect-error: to do: remove.
const micromarkExtensions =
data.micromarkExtensions || (data.micromarkExtensions = [])
/** @type {Array<unknown>} */
// @ts-expect-error: to do: remove.
const fromMarkdownExtensions =
data.fromMarkdownExtensions || (data.fromMarkdownExtensions = [])
/** @type {Array<unknown>} */
// @ts-expect-error: to do: remove.
const toMarkdownExtensions =
data.toMarkdownExtensions || (data.toMarkdownExtensions = [])

micromarkExtensions.push(directive())
fromMarkdownExtensions.push(directiveFromMarkdown)
toMarkdownExtensions.push(directiveToMarkdown)
fromMarkdownExtensions.push(directiveFromMarkdown())
toMarkdownExtensions.push(directiveToMarkdown())
}
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,20 @@
"index.js"
],
"dependencies": {
"@types/mdast": "^3.0.0",
"mdast-util-directive": "^2.0.0",
"micromark-extension-directive": "^2.0.0",
"unified": "^10.0.0"
"@types/mdast": "^4.0.0",
"mdast-util-directive": "^3.0.0",
"micromark-extension-directive": "^3.0.0",
"unified": "^11.0.0"
},
"devDependencies": {
"@types/node": "^20.0.0",
"c8": "^8.0.0",
"is-hidden": "^2.0.0",
"prettier": "^3.0.0",
"remark": "^14.0.0",
"remark": "^15.0.0",
"remark-cli": "^11.0.0",
"remark-preset-wooorm": "^9.0.0",
"to-vfile": "^7.0.0",
"to-vfile": "^8.0.0",
"type-coverage": "^2.0.0",
"typescript": "^5.0.0",
"xo": "^0.56.0"
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/container/output.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ b
d

:::e
* * f
* * f
:::

> g h
Expand Down

0 comments on commit a952370

Please sign in to comment.