Skip to content

Commit 58e423d

Browse files
authored
Upgrade gatsby-mdx to gatsby-plugin-mdx (#86)
gatsby-mdx is deprecated. Reviewed-by: Brian C <brian.m.carlson@gmail.com>
1 parent b89d22f commit 58e423d

File tree

5 files changed

+1283
-81
lines changed

5 files changed

+1283
-81
lines changed

gatsby-config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ module.exports = {
2626
}
2727
},
2828
{
29-
resolve: 'gatsby-mdx',
29+
resolve: 'gatsby-plugin-mdx',
3030
options: {
3131
gatsbyRemarkPlugins: [
3232
{

gatsby-node.js

-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
const componentWithMDXScope = require('gatsby-mdx/component-with-mdx-scope')
21
const path = require('path')
32
const startCase = require('lodash.startcase')
43

@@ -14,14 +13,8 @@ exports.createPages = ({ graphql, actions }) => {
1413
node {
1514
fields {
1615
id
17-
}
18-
tableOfContents
19-
fields {
2016
slug
2117
}
22-
code {
23-
scope
24-
}
2518
}
2619
}
2720
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
"emotion-theming": "^10.0.10",
1919
"gatsby": "2.13.23",
2020
"gatsby-link": "^2.1.1",
21-
"gatsby-mdx": "^0.6.2",
2221
"gatsby-plugin-emotion": "3.0.1",
2322
"gatsby-plugin-gtag": "^1.0.10",
2423
"gatsby-plugin-layout": "^1.0.15",
24+
"gatsby-plugin-mdx": "^1.2.22",
2525
"gatsby-plugin-react-helmet": "3.0.12",
2626
"gatsby-plugin-sharp": "^2.0.35",
2727
"gatsby-plugin-sitemap": "^2.0.12",

src/templates/docs.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { Component } from 'react'
22
import Footer from '../components/footer'
33
import Helmet from 'react-helmet'
44
import { graphql } from 'gatsby'
5-
import MDXRenderer from 'gatsby-mdx/mdx-renderer'
5+
import { MDXRenderer } from 'gatsby-plugin-mdx'
66
import styled, { injectGlobal } from 'react-emotion'
77
import { Layout, Link } from '$components'
88
import NextPrevious from '../components/NextPrevious'
@@ -115,7 +115,7 @@ export default class MDXRuntimeTest extends Component {
115115
</Edit>
116116
</div>
117117
<div className={'mainWrapper'}>
118-
<MDXRenderer>{mdx.code.body}</MDXRenderer>
118+
<MDXRenderer>{mdx.body}</MDXRenderer>
119119
</div>
120120
<div className={'addPaddTopBottom'}>
121121
<NextPrevious mdx={mdx} nav={nav} />
@@ -140,9 +140,7 @@ export const pageQuery = graphql`
140140
title
141141
slug
142142
}
143-
code {
144-
body
145-
}
143+
body
146144
tableOfContents
147145
parent {
148146
... on File {

0 commit comments

Comments
 (0)