1- import type { Node as MdastNode } from 'unist'
1+ import type { Program } from 'estree-jsx'
2+ import type { Data as HastData , ElementContent , Parent as HastParent } from 'hast'
23import type {
3- Parent as MdastParent ,
4- Literal as MdastLiteral ,
54 BlockContent ,
5+ Data as MdastData ,
66 DefinitionContent ,
7+ Literal as MdastLiteral ,
8+ Node as MdastNode ,
9+ Parent as MdastParent ,
710 PhrasingContent
811} from 'mdast'
9- import type { ElementContent , Parent as HastParent } from 'hast'
10- import type { Program } from 'estree-jsx'
12+ import type { Data , Node } from 'unist'
1113import type { Tag } from './lib/index.js'
1214
1315// Expose JavaScript API.
@@ -25,17 +27,32 @@ export type {ToMarkdownOptions} from './lib/index.js'
2527 * ^^^
2628 * ```
2729 */
28- export interface MdxJsxAttributeValueExpression extends MdastLiteral {
30+ export interface MdxJsxAttributeValueExpression extends Node {
2931 /**
3032 * Node type.
3133 */
3234 type : 'mdxJsxAttributeValueExpression'
33- data ?: {
34- /**
35- * Program node from estree.
36- */
37- estree ?: Program | null | undefined
38- } & MdastLiteral [ 'data' ]
35+
36+ /**
37+ * Value.
38+ */
39+ value : string
40+
41+ /**
42+ * Data associated with the mdast MDX JSX attribute value expression.
43+ */
44+ data ?: MdxJsxAttributeValueExpressionData | undefined
45+ }
46+
47+ /**
48+ * Info associated with mdast MDX JSX attribute value expression nodes by the
49+ * ecosystem.
50+ */
51+ export interface MdxJsxAttributeValueExpressionData extends Data {
52+ /**
53+ * Program node from estree.
54+ */
55+ estree ?: Program | null | undefined
3956}
4057
4158/**
@@ -46,17 +63,32 @@ export interface MdxJsxAttributeValueExpression extends MdastLiteral {
4663 * ^^^^^^
4764 * ```
4865 */
49- export interface MdxJsxExpressionAttribute extends MdastLiteral {
66+ export interface MdxJsxExpressionAttribute extends Node {
5067 /**
5168 * Node type.
5269 */
5370 type : 'mdxJsxExpressionAttribute'
54- data ?: {
55- /**
56- * Program node from estree.
57- */
58- estree ?: Program | null | undefined
59- } & MdastLiteral [ 'data' ]
71+
72+ /**
73+ * Value.
74+ */
75+ value : string
76+
77+ /**
78+ * Data associated with the mdast MDX JSX expression attributes.
79+ */
80+ data ?: MdxJsxExpressionAttributeData | undefined
81+ }
82+
83+ /**
84+ * Info associated with mdast MDX JSX expression attribute nodes by the
85+ * ecosystem.
86+ */
87+ export interface MdxJsxExpressionAttributeData extends Data {
88+ /**
89+ * Program node from estree.
90+ */
91+ estree ?: Program | null | undefined
6092}
6193
6294/**
@@ -67,7 +99,7 @@ export interface MdxJsxExpressionAttribute extends MdastLiteral {
6799 * ^^^^^
68100 * ```
69101 */
70- export interface MdxJsxAttribute extends MdastNode {
102+ export interface MdxJsxAttribute extends Node {
71103 /**
72104 * Node type.
73105 */
@@ -80,8 +112,18 @@ export interface MdxJsxAttribute extends MdastNode {
80112 * Attribute value.
81113 */
82114 value ?: MdxJsxAttributeValueExpression | string | null | undefined
115+ /**
116+ * Data associated with the mdast MDX JSX attribute.
117+ */
118+ data ?: MdxJsxAttributeData | undefined
83119}
84120
121+ /**
122+ * Info associated with mdast MDX JSX attribute nodes by the
123+ * ecosystem.
124+ */
125+ export interface MdxJsxAttributeData extends Data { }
126+
85127/**
86128 * MDX JSX element node, occurring in flow (block).
87129 */
@@ -102,8 +144,18 @@ export interface MdxJsxFlowElement extends MdastParent {
102144 * Content.
103145 */
104146 children : Array < BlockContent | DefinitionContent >
147+ /**
148+ * Data associated with the mdast MDX JSX elements (flow).
149+ */
150+ data ?: MdxJsxFlowElementData | undefined
105151}
106152
153+ /**
154+ * Info associated with mdast MDX JSX element (flow) nodes by the
155+ * ecosystem.
156+ */
157+ export interface MdxJsxFlowElementData extends MdastData { }
158+
107159/**
108160 * MDX JSX element node, occurring in text (phrasing).
109161 */
@@ -124,8 +176,18 @@ export interface MdxJsxTextElement extends MdastParent {
124176 * Content.
125177 */
126178 children : PhrasingContent [ ]
179+ /**
180+ * Data associated with the mdast MDX JSX elements (text).
181+ */
182+ data ?: MdxJsxTextElementData | undefined
127183}
128184
185+ /**
186+ * Info associated with mdast MDX JSX element (text) nodes by the
187+ * ecosystem.
188+ */
189+ export interface MdxJsxTextElementData extends MdastData { }
190+
129191/**
130192 * MDX JSX element node, occurring in flow (block), for hast.
131193 */
@@ -146,8 +208,18 @@ export interface MdxJsxFlowElementHast extends HastParent {
146208 * Content.
147209 */
148210 children : ElementContent [ ]
211+ /**
212+ * Data associated with the hast MDX JSX elements (flow).
213+ */
214+ data ?: MdxJsxFlowElementHastData | undefined
149215}
150216
217+ /**
218+ * Info associated with hast MDX JSX element (flow) nodes by the
219+ * ecosystem.
220+ */
221+ export interface MdxJsxFlowElementHastData extends HastData { }
222+
151223/**
152224 * MDX JSX element node, occurring in text (phrasing), for hast.
153225 */
@@ -168,19 +240,25 @@ export interface MdxJsxTextElementHast extends HastParent {
168240 * Content.
169241 */
170242 children : ElementContent [ ]
243+ /**
244+ * Data associated with the hast MDX JSX elements (text).
245+ */
246+ data ?: MdxJsxTextElementHastData | undefined
171247}
172248
249+ /**
250+ * Info associated with hast MDX JSX element (text) nodes by the
251+ * ecosystem.
252+ */
253+ export interface MdxJsxTextElementHastData extends HastData { }
254+
173255// Add nodes to mdast content.
174256declare module 'mdast' {
175- interface RootContentMap {
257+ interface BlockContentMap {
176258 /**
177259 * MDX JSX element node, occurring in flow (block).
178260 */
179261 mdxJsxFlowElement : MdxJsxFlowElement
180- /**
181- * MDX JSX element node, occurring in text (phrasing).
182- */
183- mdxJsxTextElement : MdxJsxTextElement
184262 }
185263
186264 interface PhrasingContentMap {
@@ -190,17 +268,21 @@ declare module 'mdast' {
190268 mdxJsxTextElement : MdxJsxTextElement
191269 }
192270
193- interface BlockContentMap {
271+ interface RootContentMap {
194272 /**
195273 * MDX JSX element node, occurring in flow (block).
196274 */
197275 mdxJsxFlowElement : MdxJsxFlowElement
276+ /**
277+ * MDX JSX element node, occurring in text (phrasing).
278+ */
279+ mdxJsxTextElement : MdxJsxTextElement
198280 }
199281}
200282
201283// Add nodes to hast content.
202284declare module 'hast' {
203- interface RootContentMap {
285+ interface ElementContentMap {
204286 /**
205287 * MDX JSX element node, occurring in text (phrasing).
206288 */
@@ -211,7 +293,7 @@ declare module 'hast' {
211293 mdxJsxFlowElement : MdxJsxFlowElementHast
212294 }
213295
214- interface ElementContentMap {
296+ interface RootContentMap {
215297 /**
216298 * MDX JSX element node, occurring in text (phrasing).
217299 */
0 commit comments