Skip to content

Commit de24bc1

Browse files
committed
Add typed data registries for nodes
1 parent 6259200 commit de24bc1

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

Diff for: index.d.ts

+23-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type {Literal} from 'mdast'
1+
import type {Data, Literal} from 'mdast'
22

33
export {mathFromMarkdown, mathToMarkdown} from './lib/index.js'
44

@@ -9,26 +9,46 @@ export type {ToOptions} from './lib/index.js'
99
*/
1010
export interface Math extends Literal {
1111
/**
12-
* Node type.
12+
* Node type of math (flow).
1313
*/
1414
type: 'math'
1515

1616
/**
1717
* Custom information relating to the node.
1818
*/
1919
meta?: string | null | undefined
20+
21+
/**
22+
* Data associated with the mdast math (flow).
23+
*/
24+
data?: MathData | undefined
2025
}
2126

27+
/**
28+
* Info associated with mdast math (flow) nodes by the ecosystem.
29+
*/
30+
export interface MathData extends Data {}
31+
2232
/**
2333
* Math (text).
2434
*/
2535
export interface InlineMath extends Literal {
2636
/**
27-
* Node type.
37+
* Node type of math (text).
2838
*/
2939
type: 'inlineMath'
40+
41+
/**
42+
* Data associated with the mdast math (text).
43+
*/
44+
data?: InlineMathData | undefined
3045
}
3146

47+
/**
48+
* Info associated with mdast math (text) nodes by the ecosystem.
49+
*/
50+
export interface InlineMathData extends Data {}
51+
3252
// Add custom data tracked to turn markdown into a tree.
3353
declare module 'mdast-util-from-markdown' {
3454
interface CompileData {

0 commit comments

Comments
 (0)