Skip to content

Commit

Permalink
Refactor to use @imports
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Jan 22, 2025
1 parent ce46103 commit f952db1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
30 changes: 14 additions & 16 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
/**
* @typedef {import('mdast').Nodes} Nodes
* @typedef {import('mdast').Paragraph} Paragraph
*
* @typedef {import('mdast-util-from-markdown').CompileContext} CompileContext
* @typedef {import('mdast-util-from-markdown').Extension} FromMarkdownExtension
* @typedef {import('mdast-util-from-markdown').Handle} FromMarkdownHandle
* @typedef {import('mdast-util-from-markdown').Token} Token
*
* @typedef {import('mdast-util-to-markdown').ConstructName} ConstructName
* @typedef {import('mdast-util-to-markdown').Handle} ToMarkdownHandle
* @typedef {import('mdast-util-to-markdown').Options} ToMarkdownExtension
* @typedef {import('mdast-util-to-markdown').State} State
*
* @typedef {import('../index.js').Directives} Directives
* @typedef {import('../index.js').LeafDirective} LeafDirective
* @typedef {import('../index.js').TextDirective} TextDirective
* @import {Directives, LeafDirective, TextDirective} from 'mdast-util-directive'
* @import {
* CompileContext,
* Extension as FromMarkdownExtension,
* Handle as FromMarkdownHandle,
* Token
* } from 'mdast-util-from-markdown'
* @import {
* ConstructName,
* Handle as ToMarkdownHandle,
* Options as ToMarkdownExtension,
* State
* } from 'mdast-util-to-markdown'
* @import {Nodes, Paragraph} from 'mdast'
*/

import {ok as assert} from 'devlop'
Expand Down
5 changes: 3 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -429,12 +429,13 @@ somewhere in your types, as that registers the new node types in the tree.

```js
/**
* @typedef {import('mdast-util-directive')}
* @import {} from 'mdast-util-directive'
* @import {Root} from 'mdast'
*/

import {visit} from 'unist-util-visit'

/** @type {import('mdast').Root} */
/** @type {Root} */
const tree = getMdastNodeSomeHow()

visit(tree, function (node) {
Expand Down

0 comments on commit f952db1

Please sign in to comment.