Skip to content

Commit 8ec23a3

Browse files
committed
Add types
1 parent a9d53ed commit 8ec23a3

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

index.d.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import {Buffer, SyntaxExtension, Token} from 'micromark/dist/shared-types'
2+
import {Root} from 'mdast'
3+
import {Type} from 'micromark/dist/constant/types'
4+
5+
export default fromMarkdown
6+
7+
export interface MdastExtension {
8+
enter: Record<Type, (token: Token) => void>
9+
exit: Record<Type, (token: Token) => void>
10+
}
11+
12+
interface Options {
13+
extensions?: SyntaxExtension[]
14+
mdastExtensions?: MdastExtension[]
15+
}
16+
17+
declare function fromMarkdown(value: string | Buffer, options?: Options): Root
18+
19+
declare function fromMarkdown(
20+
value: string | Buffer,
21+
encoding?: BufferEncoding,
22+
options?: Options
23+
): Root

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,12 @@
2727
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
2828
],
2929
"files": [
30-
"index.js"
30+
"index.js",
31+
"index.d.ts"
3132
],
33+
"types": "index.d.ts",
3234
"dependencies": {
35+
"@types/mdast": "^3.0.3",
3336
"mdast-util-to-string": "^1.0.0",
3437
"micromark": "~2.9.0",
3538
"parse-entities": "^2.0.0"

0 commit comments

Comments
 (0)