8
8
[ ![ Backers] [ backers-badge ]] [ collective ]
9
9
[ ![ Chat] [ chat-badge ]] [ chat ]
10
10
11
- Extensions to parse and serialize JSX between mdast and markdown .
11
+ [ mdast ] [ ] extensions to parse and serialize [ MDX ] [ ] JSX .
12
12
13
13
## Contents
14
14
@@ -31,8 +31,8 @@ Extensions to parse and serialize JSX between mdast and markdown.
31
31
32
32
## What is this?
33
33
34
- This package contains extensions that add support for the JSX syntax enabled by
35
- MDX to [ ` mdast-util-from-markdown ` ] [ mdast-util-from-markdown ] and
34
+ This package contains extensions that add support for the JSX syntax enabled
35
+ by MDX to [ ` mdast-util-from-markdown ` ] [ mdast-util-from-markdown ] and
36
36
[ ` mdast-util-to-markdown ` ] [ mdast-util-to-markdown ] .
37
37
38
38
[ JSX] [ ] is an XML-like syntax extension to ECMAScript (JavaScript), which MDX
@@ -62,14 +62,14 @@ npm install mdast-util-mdx-jsx
62
62
In Deno with [ ` esm.sh ` ] [ esmsh ] :
63
63
64
64
``` js
65
- import {mdxJsxFromMarkdown , mdxJsxToMarkdown } from ' https://esm.sh/mdast-util-mdx-jsx@1 '
65
+ import {mdxJsxFromMarkdown , mdxJsxToMarkdown } from ' https://esm.sh/mdast-util-mdx-jsx@2 '
66
66
```
67
67
68
68
In browsers with [ ` esm.sh ` ] [ esmsh ] :
69
69
70
70
``` html
71
71
<script type =" module" >
72
- import {mdxJsxFromMarkdown , mdxJsxToMarkdown } from ' https://esm.sh/mdast-util-mdx-jsx@1 ?bundle'
72
+ import {mdxJsxFromMarkdown , mdxJsxToMarkdown } from ' https://esm.sh/mdast-util-mdx-jsx@2 ?bundle'
73
73
</script >
74
74
```
75
75
@@ -205,7 +205,7 @@ console.log(out)
205
205
206
206
## API
207
207
208
- This package exports the following identifiers: ` mdxJsxFromMarkdown ` ,
208
+ This package exports the identifiers ` mdxJsxFromMarkdown ` and
209
209
` mdxJsxToMarkdown ` .
210
210
There is no default export.
211
211
@@ -214,9 +214,8 @@ There is no default export.
214
214
Function that can be called to get an extension for
215
215
[ ` mdast-util-from-markdown ` ] [ mdast-util-from-markdown ] .
216
216
217
- When using [ ` micromark-extension-mdx-jsx ` ] [ micromark-extension-mdx-jsx ]
218
- with ` options.addResult ` , nodes will have a ` data.estree ` field set to an
219
- [ ESTree] [ ] .
217
+ When using the [ syntax extension with ` addResult ` ] [ micromark-extension-mdx-jsx ] ,
218
+ nodes will have a ` data.estree ` field set to an [ ESTree] [ ] .
220
219
221
220
### ` mdxJsxToMarkdown(options?) `
222
221
@@ -247,7 +246,7 @@ of `<img />` (`boolean`, default: `false`).
247
246
248
247
###### ` options.printWidth `
249
248
250
- Try and wrap syntax as this width (` number ` , default: ` Infinity ` ).
249
+ Try and wrap syntax at this width (` number ` , default: ` Infinity ` ).
251
250
When set to a finite number (say, ` 80 ` ), the formatter will print attributes on
252
251
separate lines when a tag doesn’t fit on one line.
253
252
The normal behavior is to print attributes with spaces between them instead of
@@ -386,18 +385,18 @@ type MdxJsxPhrasingContent = MdxJsxTextElement | PhrasingContent
386
385
## Types
387
386
388
387
This package is fully typed with [ TypeScript] [ ] .
389
- It exports the ` MdxJsxAttributeValueExpression ` , ` MdxJsxAttribute ` ,
390
- ` MdxJsxExpressionAttribute ` , ` MdxJsxFlowElement ` , and ` MdxJsxTextElement ` types
391
- that represents the supported nodes.
392
- It also exports ` ToMarkdownOptions ` , which represents the structure of the
393
- respective options.
388
+ It exports the additional types ` MdxJsxAttributeValueExpression ` ,
389
+ ` MdxJsxAttribute ` , ` MdxJsxExpressionAttribute ` , ` MdxJsxFlowElement ` ,
390
+ ` MdxJsxTextElement ` , and ` ToMarkdownOptions ` .
394
391
395
392
It also registers the node types with ` @types/mdast ` .
396
393
If you’re working with the syntax tree, make sure to import this plugin
397
394
somewhere in your types, as that registers the new node types in the tree.
398
395
399
396
``` js
400
- /** @typedef {import('mdast-util-mdx-jsx')} */
397
+ /**
398
+ * @typedef {import('mdast-util-mdx-jsx')}
399
+ */
401
400
402
401
import {visit } from ' unist-util-visit'
403
402
@@ -430,8 +429,8 @@ This plugin works with `mdast-util-from-markdown` version 1+ and
430
429
431
430
## Contribute
432
431
433
- See [ ` contributing.md ` in ` syntax-tree/.github ` ] [ contributing ] for ways to get
434
- started.
432
+ See [ ` contributing.md ` ] [ contributing ] in [ ` syntax-tree/.github ` ] [ health ] for
433
+ ways to get started.
435
434
See [ ` support.md ` ] [ support ] for ways to get help.
436
435
437
436
This project has a [ code of conduct] [ coc ] .
@@ -476,11 +475,13 @@ abide by its terms.
476
475
477
476
[ author ] : https://wooorm.com
478
477
479
- [ contributing ] : https://github.com/syntax-tree/.github/blob/HEAD/contributing.md
478
+ [ health ] : https://github.com/syntax-tree/.github
480
479
481
- [ support ] : https://github.com/syntax-tree/.github/blob/HEAD/support .md
480
+ [ contributing ] : https://github.com/syntax-tree/.github/blob/main/contributing .md
482
481
483
- [ coc ] : https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md
482
+ [ support ] : https://github.com/syntax-tree/.github/blob/main/support.md
483
+
484
+ [ coc ] : https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md
484
485
485
486
[ esm ] : https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
486
487
@@ -504,8 +505,6 @@ abide by its terms.
504
505
505
506
[ dfn-mixin-mdx-jsx-element ] : #mdxjsxelement
506
507
507
- [ remark-mdx ] : https://github.com/mdx-js/mdx/tree/main/packages/remark-mdx
508
-
509
508
[ jsx ] : https://facebook.github.io/jsx/
510
509
511
510
[ what-is-mdx ] : https://mdxjs.com/docs/what-is-mdx/
@@ -515,3 +514,7 @@ abide by its terms.
515
514
[ mdast-util-to-markdown-fences ] : https://github.com/syntax-tree/mdast-util-to-markdown#optionsfences
516
515
517
516
[ mdast-util-to-markdown-resourcelink ] : https://github.com/syntax-tree/mdast-util-to-markdown#optionsresourcelink
517
+
518
+ [ remark-mdx ] : https://mdxjs.com/packages/remark-mdx/
519
+
520
+ [ mdx ] : https://mdxjs.com
0 commit comments