11import type {
2+ Data ,
23 Parent ,
34 BlockContent ,
45 DefinitionContent ,
@@ -7,6 +8,9 @@ import type {
78
89export { directiveFromMarkdown , directiveToMarkdown } from './lib/index.js'
910
11+ /**
12+ * Fields shared by directives.
13+ */
1014interface DirectiveFields {
1115 /**
1216 * Directive name.
@@ -20,54 +24,84 @@ interface DirectiveFields {
2024}
2125
2226/**
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).
2528 */
2629export interface ContainerDirective extends Parent , DirectiveFields {
2730 /**
28- * Node type.
31+ * Node type of container directive .
2932 */
3033 type : 'containerDirective'
3134
3235 /**
33- * Content .
36+ * Children of container directive .
3437 */
3538 children : Array < BlockContent | DefinitionContent >
39+
40+ /**
41+ * Data associated with the mdast container directive.
42+ */
43+ data ?: ContainerDirectiveData | undefined
3644}
3745
3846/**
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).
4153 */
4254export interface LeafDirective extends Parent , DirectiveFields {
4355 /**
44- * Node type.
56+ * Node type of leaf directive .
4557 */
4658 type : 'leafDirective'
4759
4860 /**
49- * Content .
61+ * Children of leaf directive .
5062 */
5163 children : PhrasingContent [ ]
64+
65+ /**
66+ * Data associated with the mdast leaf directive.
67+ */
68+ data ?: LeafDirectiveData | undefined
5269}
5370
5471/**
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).
5678 */
5779export interface TextDirective extends Parent , DirectiveFields {
5880 /**
59- * Node type.
81+ * Node type of text directive .
6082 */
6183 type : 'textDirective'
6284
6385 /**
64- * Content .
86+ * Children of text directive .
6587 */
6688 children : PhrasingContent [ ]
89+
90+ /**
91+ * Data associated with the text leaf directive.
92+ */
93+ data ?: TextDirectiveData | undefined
6794}
6895
6996/**
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.
71105 */
72106export type Directives = ContainerDirective | LeafDirective | TextDirective
73107
0 commit comments