1
1
import type {
2
+ Data ,
2
3
Parent ,
3
4
BlockContent ,
4
5
DefinitionContent ,
@@ -7,6 +8,9 @@ import type {
7
8
8
9
export { directiveFromMarkdown , directiveToMarkdown } from './lib/index.js'
9
10
11
+ /**
12
+ * Fields shared by directives.
13
+ */
10
14
interface DirectiveFields {
11
15
/**
12
16
* Directive name.
@@ -20,54 +24,84 @@ interface DirectiveFields {
20
24
}
21
25
22
26
/**
23
- * Directive in flow content (such as in the root document, or block
24
- * quotes), which contains further flow content.
27
+ * Markdown directive (container form).
25
28
*/
26
29
export interface ContainerDirective extends Parent , DirectiveFields {
27
30
/**
28
- * Node type.
31
+ * Node type of container directive .
29
32
*/
30
33
type : 'containerDirective'
31
34
32
35
/**
33
- * Content .
36
+ * Children of container directive .
34
37
*/
35
38
children : Array < BlockContent | DefinitionContent >
39
+
40
+ /**
41
+ * Data associated with the mdast container directive.
42
+ */
43
+ data ?: ContainerDirectiveData | undefined
36
44
}
37
45
38
46
/**
39
- * Directive in flow content (such as in the root document, or block
40
- * quotes), which contains nothing.
47
+ * Info associated with mdast container directive nodes by the ecosystem.
48
+ */
49
+ export interface ContainerDirectiveData extends Data { }
50
+
51
+ /**
52
+ * Markdown directive (leaf form).
41
53
*/
42
54
export interface LeafDirective extends Parent , DirectiveFields {
43
55
/**
44
- * Node type.
56
+ * Node type of leaf directive .
45
57
*/
46
58
type : 'leafDirective'
47
59
48
60
/**
49
- * Content .
61
+ * Children of leaf directive .
50
62
*/
51
63
children : PhrasingContent [ ]
64
+
65
+ /**
66
+ * Data associated with the mdast leaf directive.
67
+ */
68
+ data ?: LeafDirectiveData | undefined
52
69
}
53
70
54
71
/**
55
- * Directive in phrasing content (such as in paragraphs, headings).
72
+ * Info associated with mdast leaf directive nodes by the ecosystem.
73
+ */
74
+ export interface LeafDirectiveData extends Data { }
75
+
76
+ /**
77
+ * Markdown directive (text form).
56
78
*/
57
79
export interface TextDirective extends Parent , DirectiveFields {
58
80
/**
59
- * Node type.
81
+ * Node type of text directive .
60
82
*/
61
83
type : 'textDirective'
62
84
63
85
/**
64
- * Content .
86
+ * Children of text directive .
65
87
*/
66
88
children : PhrasingContent [ ]
89
+
90
+ /**
91
+ * Data associated with the text leaf directive.
92
+ */
93
+ data ?: TextDirectiveData | undefined
67
94
}
68
95
69
96
/**
70
- * The different directive nodes.
97
+ * Info associated with mdast text directive nodes by the ecosystem.
98
+ */
99
+ export interface TextDirectiveData extends Data { }
100
+
101
+ /**
102
+ * Union of registered mdast directive nodes.
103
+ *
104
+ * It is not possible to register custom mdast directive node types.
71
105
*/
72
106
export type Directives = ContainerDirective | LeafDirective | TextDirective
73
107
0 commit comments