|
20 | 20 | * [`mdxjsEsmFromMarkdown`](#mdxjsesmfrommarkdown)
|
21 | 21 | * [`mdxjsEsmToMarkdown`](#mdxjsesmtomarkdown)
|
22 | 22 | * [`MdxjsEsm`](#mdxjsesm)
|
| 23 | + * [`MdxjsEsmHast`](#mdxjsesmhast) |
23 | 24 | * [HTML](#html)
|
24 | 25 | * [Syntax](#syntax)
|
25 | 26 | * [Syntax tree](#syntax-tree)
|
@@ -197,8 +198,25 @@ MDX ESM (import/export) node (TypeScript type).
|
197 | 198 | ###### Type
|
198 | 199 |
|
199 | 200 | ```ts
|
| 201 | +import type {Program} from 'estree-jsx' |
200 | 202 | import type {Literal} from 'mdast'
|
| 203 | + |
| 204 | +interface MdxjsEsm extends Literal { |
| 205 | + type: 'mdxjsEsm' |
| 206 | + data?: {estree?: Program | null | undefined} |
| 207 | +} |
| 208 | +``` |
| 209 | + |
| 210 | +### `MdxjsEsmHast` |
| 211 | + |
| 212 | +Same as [`MdxjsEsm`][api-mdxjs-esm], but registered with `@types/hast` |
| 213 | +(TypeScript type). |
| 214 | + |
| 215 | +###### Type |
| 216 | + |
| 217 | +```ts |
201 | 218 | import type {Program} from 'estree-jsx'
|
| 219 | +import type {Literal} from 'hast' |
202 | 220 |
|
203 | 221 | interface MdxjsEsm extends Literal {
|
204 | 222 | type: 'mdxjsEsm'
|
@@ -227,7 +245,7 @@ The following interfaces are added to **[mdast][]** by this utility.
|
227 | 245 |
|
228 | 246 | ```idl
|
229 | 247 | interface MdxjsEsm <: Literal {
|
230 |
| - type: "mdxjsEsm" |
| 248 | + type: 'mdxjsEsm' |
231 | 249 | }
|
232 | 250 | ```
|
233 | 251 |
|
@@ -265,9 +283,10 @@ a *[parent][dfn-parent]*, that parent must be **[Root][dfn-root]**.
|
265 | 283 | ## Types
|
266 | 284 |
|
267 | 285 | This package is fully typed with [TypeScript][].
|
268 |
| -It exports the additional type [`MdxjsEsm`][api-mdxjs-esm]. |
| 286 | +It exports the additional types [`MdxjsEsm`][api-mdxjs-esm] and |
| 287 | +[`MdxjsEsmHast`][api-mdxjs-esm-hast]. |
269 | 288 |
|
270 |
| -It also registers the node type with `@types/mdast`. |
| 289 | +It also registers the node type with `@types/mdast` and `@types/hast`. |
271 | 290 | If you’re working with the syntax tree, make sure to import this utility
|
272 | 291 | somewhere in your types, as that registers the new node types in the tree.
|
273 | 292 |
|
@@ -389,14 +408,16 @@ abide by its terms.
|
389 | 408 |
|
390 | 409 | [dfn-root]: https://github.com/syntax-tree/mdast#root
|
391 | 410 |
|
392 |
| -[dfn-flow-content]: #flowcontent-mdxjs-esm |
393 |
| - |
394 | 411 | [remark-mdx]: https://mdxjs.com/packages/remark-mdx/
|
395 | 412 |
|
396 | 413 | [mdx]: https://mdxjs.com
|
397 | 414 |
|
| 415 | +[dfn-flow-content]: #flowcontent-mdxjs-esm |
| 416 | + |
398 | 417 | [api-mdxjs-esm-from-markdown]: #mdxjsesmfrommarkdown
|
399 | 418 |
|
400 | 419 | [api-mdxjs-esm-to-markdown]: #mdxjsesmtomarkdown
|
401 | 420 |
|
402 | 421 | [api-mdxjs-esm]: #mdxjsesm
|
| 422 | + |
| 423 | +[api-mdxjs-esm-hast]: #mdxjsesmhast |
0 commit comments