Skip to content

Commit 74aee56

Browse files
committed
Refactor docs of packages
1 parent fdfe17b commit 74aee56

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+2197
-1767
lines changed

docs/_asset/index.css

+14
Original file line numberDiff line numberDiff line change
@@ -912,6 +912,16 @@ button.success {
912912
background-color: var(--fg);
913913
}
914914

915+
details {
916+
border: 1px solid var(--gray-2);
917+
padding: 1ex;
918+
border-radius: 3px;
919+
}
920+
921+
details[open] {
922+
padding: calc(1em + 1ex);
923+
}
924+
915925
@media (prefers-color-scheme: dark) {
916926
:root {
917927
--white: #f0f6fc;
@@ -1095,6 +1105,10 @@ button.success {
10951105
border-color: var(--green-5);
10961106
color: var(--white);
10971107
}
1108+
1109+
details {
1110+
border-color: var(--gray-6);
1111+
}
10981112
}
10991113

11001114
@media (min-width: 22em) {

docs/docs/extending-mdx.mdx

+3-5
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ You can use this template:
104104
## Using plugins
105105

106106
Where to pass plugins is encoded in their name: remark plugins go in
107-
[`options.remarkPlugins`][options-remark-plugins], rehype plugins
108-
in [`options.rehypePlugins`][options-rehype-plugins].
107+
`remarkPlugins` and rehype plugins go in `rehypePlugins` of
108+
[`ProcessorOptions`][processor-options].
109109
Those fields expect lists of plugins and/or of `[plugin, options]`:
110110

111111
```tsx
@@ -169,9 +169,7 @@ For info on the node types that represent MDX specific features, see
169169

170170
[start]: /docs/getting-started/
171171

172-
[options-remark-plugins]: /packages/mdx/#optionsremarkplugins
173-
174-
[options-rehype-plugins]: /packages/mdx/#optionsrehypeplugins
172+
[processor-options]: /packages/mdx/#processoroptions
175173

176174
[architecture]: /packages/mdx/#architecture
177175

docs/docs/getting-started.mdx

+17-16
Original file line numberDiff line numberDiff line change
@@ -108,28 +108,31 @@ your JSX runtime.
108108
you don’t need to do anything.
109109
Optionally install and configure [`@mdx-js/react`][mdx-react]
110110
* If you’re using **Preact**,
111-
set [`options.jsxImportSource`][options-jsximportsource] to `'preact'`.
111+
set [`jsxImportSource` in `ProcessorOptions`][processor-options] to
112+
`'preact'`.
112113
Optionally install and configure [`@mdx-js/preact`][mdx-preact]
113114
* If you’re using **Svelte**,
114115
install [`svelte-jsx`][svelte-jsx].
115-
Set [`options.jsxImportSource`][options-jsximportsource] to `'svelte-jsx'`.
116+
Set [`jsxImportSource` in `ProcessorOptions`][processor-options] to
117+
`'svelte-jsx'`.
116118
* If you’re using **Vue 3**,
117-
set [`options.jsx`][options-jsx] to `true`.
119+
set [`jsx` in `ProcessorOptions`][processor-options] to `true`.
118120
Then use Babel alongside your MDX integration (which is possible with
119121
webpack and Rollup but not esbuild) and configure it to use
120122
[`@vue/babel-plugin-jsx`](https://github.com/vuejs/jsx-next/tree/dev/packages/babel-plugin-jsx).
121123
Optionally install and configure [`@mdx-js/vue`][mdx-vue]
122124
* If you’re using **Emotion**,
123-
set [`options.jsxImportSource`][options-jsximportsource] to
125+
set [`jsxImportSource` in `ProcessorOptions`][processor-options] to
124126
`'@emotion/react'`
125127
* If you’re using **Theme UI**,
126128
install and configure [`@mdx-js/react`][mdx-react].
127129
Then wrap your MDX content in a `<ThemeProvider />`
128130
* If you’re using **Solid**,
129-
set [`options.jsxImportSource`][options-jsximportsource] to `'solid-js/h'`
131+
set [`jsxImportSource` in `ProcessorOptions`][processor-options] to
132+
`'solid-js/h'`
130133

131134
Other JSX runtimes are supported by setting
132-
[`options.jsxImportSource`][options-jsximportsource].
135+
[`jsxImportSource` in `ProcessorOptions`][processor-options].
133136
See also the different options there on how to use the classic JSX runtime
134137
and how to define a `pragma` and `pragmaFrag` for it.
135138

@@ -719,7 +722,7 @@ on how to use MDX with React Static.
719722
</details>
720723

721724
[Emotion](https://emotion.sh/docs/introduction) is supported when
722-
[`options.jsxImportSource`][options-jsximportsource] is set to
725+
[`jsxImportSource` in `ProcessorOptions`][processor-options] is set to
723726
`'@emotion/react'`.
724727
You can optionally install and configure [`@mdx-js/react`][mdx-react], which
725728
allows for context based component passing.
@@ -780,8 +783,8 @@ more info.
780783
```
781784
</details>
782785

783-
Preact is supported when [`options.jsxImportSource`][options-jsximportsource] is
784-
set to `'preact'`.
786+
Preact is supported when [`jsxImportSource` in `ProcessorOptions`][processor-options]
787+
is set to `'preact'`.
785788
You can optionally install and configure [`@mdx-js/preact`][mdx-preact], which
786789
allows for context based component passing.
787790

@@ -856,8 +859,8 @@ info.
856859
```
857860
</details>
858861

859-
Svelte is supported when [`options.jsxImportSource`][options-jsximportsource] is
860-
set to `'svelte-jsx'`, which is a [small package][svelte-jsx] that adds support
862+
Svelte is supported when [`jsxImportSource` in `ProcessorOptions`][processor-options]
863+
is set to `'svelte-jsx'`, which is a [small package][svelte-jsx] that adds support
861864
for the JSX automatic runtime to Svelte.
862865

863866
See also [¶ esbuild][esbuild], [¶ Rollup][rollup], and [¶ webpack][webpack],
@@ -899,8 +902,8 @@ for more info.
899902
```
900903
</details>
901904

902-
Solid is supported when [`options.jsxImportSource`][options-jsximportsource] is
903-
set to `'solid-js/h'`.
905+
Solid is supported when [`jsxImportSource` in `ProcessorOptions`][processor-options]
906+
is set to `'solid-js/h'`.
904907

905908
See also [¶ Vite][vite] and [¶ Rollup][rollup] which you might be using, for
906909
more info.
@@ -961,9 +964,7 @@ See their readmes on how to configure them.
961964

962965
[evaluate]: /packages/mdx/#evaluatefile-options
963966

964-
[options-jsximportsource]: /packages/mdx/#optionsjsximportsource
965-
966-
[options-jsx]: /packages/mdx/#optionsjsx
967+
[processor-options]: /packages/mdx/#processoroptions
967968

968969
[cra]: #create-react-app-cra
969970

docs/docs/using-mdx.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ Set it up like so:
377377
or [`@mdx-js/vue`][mdx-vue],
378378
depending on what framework you’re using
379379
2. Configure your MDX integration with
380-
[`options.providerImportSource`][options-provider-import-source]
380+
[`providerImportSource` in `ProcessorOptions`][processor-options]
381381
set to that package, so either `'@mdx-js/react'`, `'@mdx-js/preact'`, or
382382
`'@mdx-js/vue'`
383383
3. Import `MDXProvider` from that package.
@@ -478,7 +478,7 @@ providers: pass components explicitly.
478478

479479
[mdx-vue]: /packages/vue/
480480

481-
[options-provider-import-source]: /packages/mdx/#optionsproviderimportsource
481+
[processor-options]: /packages/mdx/#processoroptions
482482

483483
[emotion]: /docs/getting-started/#emotion
484484

docs/docs/what-is-mdx.mdx

+1-3
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ in braces (`{1 + 1}`) and ESM (`import` and `export`).
7878
Or use it always.
7979
If you’re using a bundler integration you can change between MDX and
8080
markdown through the file extension (`.mdx` vs. `.md`).
81-
Alternatively, [`options.format`][format] can be used.
81+
Alternatively, `options.format` can be used.
8282
</Note>
8383

8484
The MDX syntax combines markdown with JSX.
@@ -347,8 +347,6 @@ the heading.
347347

348348
[jsx-spec]: https://facebook.github.io/jsx/
349349

350-
[format]: /packages/mdx/#optionsformat
351-
352350
[start]: /docs/getting-started/
353351

354352
[trouble]: /docs/troubleshooting-mdx/

docs/guides/frontmatter.mdx

+3-3
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ title: Hi, World!
8787
That’s exactly what the remark plugin
8888
[`remark-mdx-frontmatter`][remark-mdx-frontmatter] does.
8989

90-
remark plugins can be passed in
91-
[`options.remarkPlugins`][options-remark-plugins].
90+
remark plugins can be passed as
91+
[`remarkPlugins` in `ProcessorOptions`][processor-options].
9292
More info on plugins is available in [§ Extending MDX][extend]
9393

9494
[commonmark]: https://spec.commonmark.org/current/
@@ -97,6 +97,6 @@ More info on plugins is available in [§ Extending MDX][extend]
9797

9898
[remark-mdx-frontmatter]: https://github.com/remcohaszing/remark-mdx-frontmatter
9999

100-
[options-remark-plugins]: /packages/mdx/#optionsremarkplugins
100+
[processor-options]: /packages/mdx/#processoroptions
101101

102102
[extend]: /docs/extending-mdx/

docs/guides/gfm.mdx

+3-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ MDX supports standard markdown syntax ([CommonMark][]).
1515
That means [GitHub flavored markdown (GFM)][gfm] extensions are not supported by
1616
default.
1717
They can be enabled by using a remark plugin: [`remark-gfm`][remark-gfm].
18-
Such plugins can be passed in [`options.remarkPlugins`][options-remark-plugins].
18+
Such plugins can be passed in [`remarkPlugins` in
19+
`ProcessorOptions`][processor-options].
1920
More info on plugins is available in [§ Extending MDX][extend]
2021

2122
Say we have an MDX file like this:
@@ -121,6 +122,6 @@ console.log(
121122

122123
[remark-gfm]: https://github.com/remarkjs/remark-gfm
123124

124-
[options-remark-plugins]: /packages/mdx/#optionsremarkplugins
125+
[processor-options]: /packages/mdx/#processoroptions
125126

126127
[extend]: /docs/extending-mdx/

docs/guides/math.mdx

+3-6
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ Math can be enabled by using a remark plugin: [`remark-math`][remark-math],
1818
combined with a rehype plugin: either
1919
[`rehype-katex`][rehype-katex] (KaTeX) or [`rehype-mathjax`][rehype-mathjax]
2020
(MathJax).
21-
remark plugins can be passed in
22-
[`options.remarkPlugins`][options-remark-plugins] and rehype
23-
plugins in [`options.rehypePlugins`][options-rehype-plugins].
21+
Plugins can be passed in
22+
[`rehypePlugins` and `remarkPlugins` in `ProcessorOptions`][processor-options].
2423
More info on plugins is available in [§ Extending MDX][extend]
2524

2625
Say we have an MDX file like this:
@@ -93,9 +92,7 @@ console.log(
9392

9493
[rehype-mathjax]: https://github.com/remarkjs/remark-math/tree/main/packages/rehype-mathjax
9594

96-
[options-remark-plugins]: /packages/mdx/#optionsremarkplugins
97-
98-
[options-rehype-plugins]: /packages/mdx/#optionsrehypeplugins
95+
[processor-options]: /packages/mdx/#processoroptions
9996

10097
[extend]: /docs/extending-mdx/
10198

docs/guides/mdx-on-demand.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,6 @@ export async function getStaticProps() {
105105

106106
[compile]: /packages/mdx/#compilefile-options
107107

108-
[run]: /packages/mdx/#runfunctionbody-options
108+
[run]: /packages/mdx/#runcode-options
109109

110110
[eval]: /packages/mdx/#evaluatefile-options

docs/migrating/v2.mdx

+11-28
Original file line numberDiff line numberDiff line change
@@ -204,10 +204,8 @@ For more information, please see [§ API in `@mdx-js/loader`][loader-api].
204204

205205
The options accepted by the loader changed:
206206

207-
* `renderer` is replaced by
208-
[`options.jsxImportSource`][mdx-options-jsximportsource],
209-
[`options.providerImportSource`][mdx-options-providerimportsource],
210-
and others options.
207+
* `renderer` is replaced by `jsxImportSource`, `providerImportSource`, and
208+
others options.
211209
More info in [§ API in `@mdx-js/mdx`][mdx-api]
212210
* Other options were undocumented but passed to `@mdx-js/mdx`.
213211
See `@mdx-js/mdx` below if needed
@@ -326,13 +324,10 @@ Options in version 1 were undocumented.
326324
If you used them:
327325

328326
* `filepath` is replaced by accepting a VFile or compatible object as the
329-
first argument [`file`][mdx-file]
330-
* `compilers` is replaced by
331-
[`options.recmaPlugins`][mdx-options-recmaplugins]
332-
* `hastPlugins` is replaced by
333-
[`options.rehypePlugins`][mdx-options-rehypeplugins]
334-
* `mdPlugins` is replaced by
335-
[`options.remarkPlugins`][mdx-options-remarkplugins]
327+
first argument `file`
328+
* `compilers` is replaced by `recmaPlugins`
329+
* `hastPlugins` is replaced by `rehypePlugins`
330+
* `mdPlugins` is replaced by `options.remarkPlugins`
336331
* `skipExport` is removed, [`evaluate`][mdx-evaluate] can do this
337332
automatically
338333
* `wrapExport` is removed, use a custom recma plugin instead
@@ -666,15 +661,15 @@ With our new AST, we’re able to create codemods from now on.
666661

667662
[remark-mdx-use]: /packages/remark-mdx/#use
668663

669-
[mdx-compile]: /packages/mdx/#compile
664+
[mdx-compile]: /packages/mdx/#compilefile-options
670665

671-
[mdx-compilesync]: /packages/mdx/#compilesync
666+
[mdx-compilesync]: /packages/mdx/#compilesyncfile-options
672667

673-
[mdx-createprocessor]: /packages/mdx/#createprocessor
668+
[mdx-createprocessor]: /packages/mdx/#createprocessoroptions
674669

675-
[mdx-evaluate]: /packages/mdx/#evaluate
670+
[mdx-evaluate]: /packages/mdx/#evaluatefile-options
676671

677-
[mdx-evaluatesync]: /packages/mdx/#evaluatesync
672+
[mdx-evaluatesync]: /packages/mdx/#evaluatesyncfile-options
678673

679674
[mdx-react]: /packages/react/
680675

@@ -686,18 +681,6 @@ With our new AST, we’re able to create codemods from now on.
686681

687682
[vfile]: https://github.com/vfile/vfile
688683

689-
[mdx-file]: /packages/mdx/#file
690-
691-
[mdx-options-recmaplugins]: /packages/mdx/#optionsrecmaplugins
692-
693-
[mdx-options-remarkplugins]: /packages/mdx/#optionsremarkplugins
694-
695-
[mdx-options-rehypeplugins]: /packages/mdx/#optionsrehypeplugins
696-
697-
[mdx-options-jsximportsource]: /packages/mdx/#optionsjsximportsource
698-
699-
[mdx-options-providerimportsource]: /packages/mdx/#optionsproviderimportsource
700-
701684
[babel-loader]: https://webpack.js.org/loaders/babel-loader/
702685

703686
[loader-api]: /packages/loader/#api

0 commit comments

Comments
 (0)