@@ -5,7 +5,7 @@ export const info = {
55 {name: ' Titus Wormer' , github: ' wooorm' , twitter: ' wooorm' }
66 ],
77 published: new Date (' 2021-10-05' ),
8- modified: new Date (' 2022-06-17 ' )
8+ modified: new Date (' 2022-12-14 ' )
99}
1010
1111# Getting started
@@ -193,7 +193,7 @@ You can also import several types about the API of MDX files from `@types/mdx`.
193193For example:
194194
195195``` js path="example.ts"
196- import type {MDXComponents } from ' mdx/types'
196+ import type {MDXComponents } from ' mdx/types.js '
197197```
198198
199199### Security
@@ -514,33 +514,42 @@ Which in turn lets us choose whether to use the `@mdx-js/mdx` or
514514
515515#### Astro
516516
517- [ Astro] ( https://astro.build/ ) has an [ official MDX integration] ( https://docs.astro.build/guides/integrations-guide/mdx/ ) .
517+ [ Astro] ( https://astro.build/ ) has their own MDX integration.
518518You can add the integration with the Astro CLI (recommended):
519519
520520``` sh
521521npx astro add mdx
522522```
523523
524- This base setup allows you to import markdown, Astro components,
525- and other MDX files as components. To use
526- other UI framework components in your MDX files
527- (e.g. Preact, Vue, Svelte and more),
528- see Astro’s [ Framework components ] ( https://docs.astro.build/en/core-concepts/framework-components/ ) guide.
524+ This base setup allows you to import markdown, Astro components, and other MDX
525+ files as components.
526+ To use components from frameworks in your MDX files, see Astro’s
527+ [ Framework components ] ( https://docs.astro.build/core-concepts/framework-components/ )
528+ guide.
529529
530- To learn how to configure layouts, YAML frontmatter, and set up Astro’s
531- syntax highlighting, [ see their MDX
530+ For more on how to combine Astro and MDX, see [ their MDX
532531integration docs] ( https://docs.astro.build/guides/integrations-guide/mdx/ ) .
533532
534533#### Create React App (CRA)
535534
536535<Note type = " info" >
537- ** Note** : rewiring with CRACO (see below) is currently required for CRA 5,
538- due to a bug in ` react-scripts `
536+ ** Note** : it’s currently probably not a good idea to use CRA.
537+ </Note >
538+
539+ <Note type = " info" >
540+ ** Note** : rewiring with CRACO is currently required for CRA 5, due to a bug
541+ in ` react-scripts `
539542 ([ ` facebook/create-react-app#12166 ` ] ( https://github.com/facebook/create-react-app/issues/12166 ) ),
540543 which is also tracked at
541544 [ ` mdx-js/mdx#1870 ` ] ( https://github.com/mdx-js/mdx/discussions/1870 ) .
542545</Note >
543546
547+ <Note type = " info" >
548+ ** Note** : warnings about CRACO having
549+ ` incorrect peer dependency "react-scripts@^4.0.0" `
550+ can currently be ignored.
551+ </Note >
552+
544553<details >
545554 <summary >Expand example</summary >
546555
@@ -560,11 +569,6 @@ integration docs](https://docs.astro.build/guides/integrations-guide/mdx/).
560569 ```
561570</details >
562571
563- [ CRA] ( https://github.com/facebook/create-react-app ) supports webpack loaders
564- through webpack loader syntax in imports.
565-
566- Install the webpack loader [ ` @mdx-js/loader ` ] [ mdx-loader ] .
567-
568572<details >
569573 <summary >Expand CRACO example</summary >
570574
@@ -593,16 +597,15 @@ Install the webpack loader [`@mdx-js/loader`][mdx-loader].
593597 ```
594598</details >
595599
600+ [ CRA] ( https://github.com/facebook/create-react-app ) supports webpack loaders
601+ through webpack loader syntax in imports.
602+
603+ Install the webpack loader [ ` @mdx-js/loader ` ] [ mdx-loader ] .
604+
596605For importing MDX without the ` !@mdx-js/loader! ` prefix, you can add
597606the loader to the webpack config, by rewiring ` react-scripts ` using
598607[ CRACO] ( http://github.com/gsoft-inc/craco ) .
599608
600- <Note type = " info" >
601- ** Note** : warnings about CRACO having
602- ` incorrect peer dependency "react-scripts@^4.0.0" `
603- can be ignored for the above to work.
604- </Note >
605-
606609See also [ ¶ Webpack] [ webpack ] , which is used in CRA, and see [ ¶ React] [ react ] ,
607610which you’re likely using, for more info.
608611
@@ -624,15 +627,15 @@ on how to use MDX with Gatsby.
624627 <summary >Expand example</summary >
625628
626629 ``` js path="next.config.js"
627- import nextMDX from ' @next/mdx'
630+ import nextMdx from ' @next/mdx'
628631
629- const withMDX = nextMDX ({
632+ const withMdx = nextMdx ({
630633 // By default only the .mdx extension is supported.
631634 extension: / \. mdx? $ / ,
632635 options: {/* providerImportSource: …, otherOptions… */ }
633636 })
634637
635- export default withMDX ({
638+ export default withMdx ({
636639 // Support MDX files as pages:
637640 pageExtensions: [' md' , ' mdx' , ' tsx' , ' ts' , ' jsx' , ' js' ],
638641 })
@@ -649,18 +652,18 @@ In order to use it, you need to configure the `providerImportSource` as
649652well.
650653
651654<details >
652- <summary >Expand example</summary >
655+ <summary >Expand provider example</summary >
653656
654657 ``` js path="next.config.js"
655- import nextMDX from ' @next/mdx'
658+ import nextMdx from ' @next/mdx'
656659
657- const withMDX = nextMDX ({
660+ const withMdx = nextMdx ({
658661 // By default only the .mdx extension is supported.
659662 extension: / \. mdx? $ / ,
660663 options: {providerImportSource: ' @mdx-js/react' , /* otherOptions… */ }
661664 })
662665
663- export default withMDX ({
666+ export default withMdx ({
664667 // Support MDX files as pages:
665668 pageExtensions: [' md' , ' mdx' , ' tsx' , ' ts' , ' jsx' , ' js' ],
666669 })
0 commit comments