You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are many Gatsby Remark plugins which you can install to customize how Markdown is processed. Many of them are demoed at https://using-remark.gatsbyjs.org/. See also the [source code for using-remark](https://github.com/gatsbyjs/gatsby/tree/master/examples/using-remark).
38
38
39
39
## Parsing algorithm
40
40
41
41
It recognizes files with the following extensions as Markdown:
42
42
43
-
-md
44
-
- markdown
43
+
-`md`
44
+
-`markdown`
45
45
46
46
Each Markdown file is parsed into a node of type `MarkdownRemark`.
47
47
48
-
All frontmatter fields are converted into GraphQL fields. TODO link to docs on
49
-
auto-inferring types/fields.
48
+
All frontmatter fields are converted into GraphQL fields through [inference](https://www.gatsbyjs.com/docs/glossary/#inference).
50
49
51
50
This plugin adds additional fields to the `MarkdownRemark` GraphQL type
52
51
including `html`, `excerpt`, `headings`, etc. Other Gatsby plugins can also add
@@ -93,9 +92,9 @@ Using the following GraphQL query you'll be able to get the table of contents
93
92
}
94
93
```
95
94
96
-
### Configuring the tableOfContents
95
+
### Configuring the `tableOfContents`
97
96
98
-
By default, `absolute` is set to false, generating a relative path. If you'd like to generate an absolute path, pass `absolute: true`. In that case, be sure to pass the `pathToSlugField` parameter, often `fields.slug`, to create absolute URLs. **Note** that providing a non-existent field will cause the result to be null. To alter the default values for tableOfContents generation, include values for `heading` (string) and/or `maxDepth` (number 1 to 6) in GraphQL query. If a value for `heading` is given, the first heading that matches will be omitted and the toc is generated from the next heading of the same depth onwards. Value for `maxDepth` sets the maximum depth of the toc (i.e. if a maxDepth of 3 is set, only h1 to h3 headings will appear in the toc).
97
+
By default, `absolute` is set to `false`, generating a relative path. If you'd like to generate an absolute path, pass `absolute: true`. In that case, be sure to pass the `pathToSlugField` parameter, often `fields.slug`, to create absolute URLs. **Note** that providing a non-existent field will cause the result to be `null`. To alter the default values for `tableOfContents` generation, include values for `heading` (string) and/or `maxDepth` (number 1 to 6) in GraphQL query. If a value for `heading` is given, the first heading that matches will be omitted and the ToC is generated from the next heading of the same depth onwards. Value for `maxDepth` sets the maximum depth of the toc (i.e. if a maxDepth of 3 is set, only h1 to h3 headings will appear in the toc).
99
98
100
99
```graphql
101
100
{
@@ -119,7 +118,7 @@ By default, `absolute` is set to false, generating a relative path. If you'd lik
119
118
}
120
119
```
121
120
122
-
To pass default options to the plugin generating the tableOfContents, configure it in gatsby-config.js as shown below. The options shown below are the defaults used by the plugin.
121
+
To pass default options to the plugin generating the `tableOfContents`, configure it in `gatsby-config.js` as shown below. The options shown below are the defaults used by the plugin.
123
122
124
123
```javascript
125
124
// In your gatsby-config.js
@@ -171,7 +170,7 @@ By default, Gatsby will return excerpts as plain text. This might be useful for
171
170
}
172
171
```
173
172
174
-
It's also possible to ask Gatsby to return excerpts formatted as HTML. You might use this if you have a blog post whose excerpt contains markdown content--e.g. header, link, etc.--and you want these links to render as HTML.
173
+
It's also possible to ask Gatsby to return excerpts formatted as HTML. You might use this if you have a blog post whose excerpt contains markdown content -- e.g. header, link, etc. -- and you want these links to render as HTML.
175
174
176
175
```graphql
177
176
{
@@ -199,9 +198,9 @@ You can also get excerpts in Markdown format.
199
198
}
200
199
```
201
200
202
-
## gray-matter options
201
+
## `gray-matter` options
203
202
204
-
`gatsby-transformer-remark` uses [gray-matter](https://github.com/jonschlinkert/gray-matter) to parse markdown frontmatter, so you can specify any of the options mentioned [here](https://github.com/jonschlinkert/gray-matter#options) in the `gatsby-config.js` file.
203
+
`gatsby-transformer-remark` uses [gray-matter](https://github.com/jonschlinkert/gray-matter) to parse Markdown frontmatter, so you can specify any of the options mentioned [here](https://github.com/jonschlinkert/gray-matter#options) in the `gatsby-config.js` file.
0 commit comments