Skip to content

Commit b1b83c1

Browse files
authored
chore(gatsby-plugin-mdx): Update "headings" instructions (#36593)
1 parent e174fbb commit b1b83c1

File tree

5 files changed

+34
-4
lines changed

5 files changed

+34
-4
lines changed

examples/using-mdx/content/posts/blog-1.mdx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,12 @@ Some GFM features like tables:
1111

1212
| Hello | World | | | |
1313
|---------|-------|---|---|---|
14-
| How are | you? | | | |
14+
| How are | you? | | | |
15+
16+
## Heading Level Two
17+
18+
Some text
19+
20+
### Heading Level Three
21+
22+
Some more text

examples/using-mdx/content/posts/blog-2.mdx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,12 @@ You can use the Collapsible shortcode here because you provide it in the src/tem
1515

1616
You'll find content here!
1717

18-
</Collapsible>
18+
</Collapsible>
19+
20+
## Heading Level Two
21+
22+
Some text
23+
24+
### Heading Level Three
25+
26+
Some more text

examples/using-mdx/gatsby-config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/**
2+
* @type {import('gatsby').GatsbyConfig}
3+
*/
14
module.exports = {
25
siteMetadata: {
36
title: `Using MDX example`,

examples/using-mdx/gatsby-node.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ const slugify = require(`@sindresorhus/slugify`)
44
const { compileMDXWithCustomOptions } = require(`gatsby-plugin-mdx`)
55
const { remarkHeadingsPlugin } = require(`./remark-headings-plugin`)
66

7+
/**
8+
* @type {import('gatsby').GatsbyNode['onCreateNode']}
9+
*/
710
exports.onCreateNode = ({ node, actions }) => {
811
const { createNodeField } = actions
912
if (node.internal.type === `Mdx`) {
@@ -21,7 +24,10 @@ exports.onCreateNode = ({ node, actions }) => {
2124
}
2225
}
2326

24-
exports.createSchemaCustomization = async ({ getNode, getNodesByType, pathPrefix, reporter, cache, actions, schema }) => {
27+
/**
28+
* @type {import('gatsby').GatsbyNode['createSchemaCustomization']}
29+
*/
30+
exports.createSchemaCustomization = async ({ getNode, getNodesByType, pathPrefix, reporter, cache, actions, schema, store }) => {
2531
const { createTypes } = actions
2632

2733
const headingsResolver = schema.buildObjectType({
@@ -53,6 +59,7 @@ exports.createSchemaCustomization = async ({ getNode, getNodesByType, pathPrefix
5359
pathPrefix,
5460
reporter,
5561
cache,
62+
store,
5663
}
5764
)
5865

@@ -81,6 +88,9 @@ exports.createSchemaCustomization = async ({ getNode, getNodesByType, pathPrefix
8188
])
8289
}
8390

91+
/**
92+
* @type {import('gatsby').GatsbyNode['createPages']}
93+
*/
8494
exports.createPages = async ({ graphql, actions, reporter }) => {
8595
const { createPage } = actions
8696

packages/gatsby-plugin-mdx/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ If you don't want to use the `frontmatter.title`, adjust what you input to `slug
382382
const { compileMDXWithCustomOptions } = require(`gatsby-plugin-mdx`)
383383
const { remarkHeadingsPlugin } = require(`./remark-headings-plugin`)
384384

385-
exports.createSchemaCustomization = async ({ getNode, getNodesByType, pathPrefix, reporter, cache, actions, schema }) => {
385+
exports.createSchemaCustomization = async ({ getNode, getNodesByType, pathPrefix, reporter, cache, actions, schema, store }) => {
386386
const { createTypes } = actions
387387

388388
const headingsResolver = schema.buildObjectType({
@@ -414,6 +414,7 @@ If you don't want to use the `frontmatter.title`, adjust what you input to `slug
414414
pathPrefix,
415415
reporter,
416416
cache,
417+
store,
417418
}
418419
)
419420

0 commit comments

Comments
 (0)