Skip to content

Commit de153b6

Browse files
axe312gerimjoshinLekoArtswardpeettyhopp
authored
chore(docs): MDX v2 (#35893)
Co-authored-by: Josh Johnson <[email protected]> Co-authored-by: LekoArts <[email protected]> Co-authored-by: Lennart <[email protected]> Co-authored-by: Ward Peeters <[email protected]> Co-authored-by: Ty Hopp <[email protected]> Co-authored-by: Levi Zim <[email protected]> Co-authored-by: pieh <[email protected]> Co-authored-by: Michal Piechowiak <[email protected]>
1 parent 28cfade commit de153b6

25 files changed

+415
-1072
lines changed

docs/docs/glossary/mdx.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export const Figure = props => {
3838
Now you can import this component into your Markdown document.
3939

4040
```markdown
41-
import { Figure } from './components/Figure';
41+
import { Figure } from "./components/Figure"
4242

4343
# Hello world!
4444

docs/docs/how-to/plugins-and-themes/configuring-usage-with-plugin-options.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ Any JavaScript data type can be passed in as an option.
4848

4949
The following table lists possible options values and an example plugin that makes use of them.
5050

51-
| Data Type | Sample Value | Example Plugin |
52-
| --------- | -------------------------------- | ---------------------------------------------------------------- |
53-
| Boolean | `true` | [`gatsby-plugin-sharp`](/plugins/gatsby-plugin-sharp/) |
54-
| String | `/src/data/` | [`gatsby-source-filesystem`](/plugins/gatsby-source-filesystem/) |
55-
| Array | `["/about-us/", "/projects/*"]` | [`gatsby-plugin-offline`](/plugins/gatsby-plugin-offline/) |
56-
| Object | `{ default: "./src/layout.js" }` | [`gatsby-plugin-mdx`](/plugins/gatsby-plugin-mdx/) |
51+
| Data Type | Sample Value | Example Plugin |
52+
| --------- | ------------------------------- | ---------------------------------------------------------------- |
53+
| Boolean | `true` | [`gatsby-plugin-sharp`](/plugins/gatsby-plugin-sharp/) |
54+
| String | `/src/data/` | [`gatsby-source-filesystem`](/plugins/gatsby-source-filesystem/) |
55+
| Array | `["/about-us/", "/projects/*"]` | [`gatsby-plugin-offline`](/plugins/gatsby-plugin-offline/) |
56+
| Object | `{ mdxOptions: {} }` | [`gatsby-plugin-mdx`](/plugins/gatsby-plugin-mdx/) |
5757

5858
**Note**: Themes (which are a type of plugin) are able to receive options from a site's `gatsby-config.js` to be used in its `gatsby-config.js` in order to allow themes to be composed together. This is done by exporting the `gatsby-config.js` as a function instead of an object. You can see an example of this in the [`gatsby-theme-blog`](https://github.com/gatsbyjs/themes/tree/master/packages/gatsby-theme-blog) and [`gatsby-theme-blog-core`](https://github.com/gatsbyjs/themes/tree/master/packages/gatsby-theme-blog-core) repositories. Plugins are not capable of this functionality.
5959

docs/docs/how-to/plugins-and-themes/using-a-plugin-in-your-site.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Add the plugin as a project dependency in your `package.json` file by running th
3434
npm install gatsby-plugin-sitemap
3535
```
3636

37-
Check the plugin's README file to see if there are any other dependencies that you also need to install. (For example, [`gatsby-plugin-mdx`](/plugins/gatsby-plugin-mdx/) also requires `@mdx-js/mdx` and `@mdx-js/react` to be installed.)
37+
Check the plugin's README file to see if there are any other dependencies that you also need to install. (For example, [`gatsby-plugin-mdx`](/plugins/gatsby-plugin-mdx/) also requires `@mdx-js/react` to be installed.)
3838

3939
### Step 2: Configure the plugin in your `gatsby-config.js` file
4040

docs/docs/how-to/querying-data/page-query.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ Consider the following query:
153153
154154
```js:title=src/templates/blog-post.js
155155
export const query = graphql`
156-
query MdxBlogPost {
156+
query {
157157
mdx(title: { eq: "Using a Theme" }) {
158158
id
159159
title
@@ -168,7 +168,7 @@ In addition to hardcoding an argument directly into the page query, you can pass
168168
169169
```js:title=src/templates/blog-post.js
170170
export const query = graphql`
171-
query MdxBlogPost($title: String) { // highlight-line
171+
query ($title: String) { // highlight-line
172172
mdx(title: {eq: $title}) { // highlight-line
173173
id
174174
title

docs/docs/how-to/routing/customizing-components.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Using MDX, you can replace every HTML element that Markdown renders with a
66
custom implementation. This allows you to use a set of design system components
77
when rendering.
88

9-
```jsx:title=src/components/layout.js
9+
```jsx:title=src/components/layout.jsx
1010
import { MDXProvider } from "@mdx-js/react"
1111
import * as DesignSystem from "your-design-system"
1212

@@ -28,7 +28,7 @@ export default function Layout({ children }) {
2828
}
2929
```
3030

31-
**Note**: you can also provide your own custom components to the `MDXProvider` that make them globally available while writing MDX. You can find more details about this pattern in the [Importing and Using Components in MDX guide](/docs/mdx/importing-and-using-components#make-components-available-globally-as-shortcodes).
31+
**Note**: You can also provide your own custom components to the `MDXProvider` that make them globally available while writing MDX. You can find more details about this pattern in the [Importing and Using Components in MDX guide](/docs/how-to/routing/mdx#make-components-available-globally-as-shortcodes).
3232

3333
The following components can be customized with the MDXProvider:
3434

@@ -68,10 +68,10 @@ The following components can be customized with the MDXProvider:
6868

6969
## How does this work?
7070

71-
Components passed to the MDXProvider are used to render the HTML elements
72-
that Markdown creates. It uses
73-
[React's Context API](https://reactjs.org/docs/context.html).
71+
Components passed to the MDXProvider are used to render the HTML elements that Markdown creates. It uses [React's Context API](https://reactjs.org/docs/context.html).
7472

7573
## Related
7674

7775
- [MDX components](https://mdxjs.com/getting-started/)
76+
- [Adding Components to Markdown with MDX](/docs/how-to/routing/mdx/)
77+
- [gatsby-plugin-mdx README](/plugins/gatsby-plugin-mdx)

0 commit comments

Comments
 (0)