Skip to content

Commit

Permalink
Fix plugins not running gatsby-browser.js (#4329)
Browse files Browse the repository at this point in the history
* Fix DOM nesting error

validateDOMNesting(...): <div> cannot appear as a descendant of <p>

* Fix plugins that don't export any gatsby-browser.js APIs

* Remove unused imports

* Add missing links
  • Loading branch information
m-allanson authored and KyleAMathews committed Mar 2, 2018
1 parent fc2180e commit afa6a5c
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 13 deletions.
1 change: 0 additions & 1 deletion examples/using-remark/src/layouts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React from "react"
import Link from "gatsby-link"
import { rhythm, scale } from "../utils/typography"
import styles from "../styles"
import presets from "../utils/presets"

import "typeface-space-mono"
import "typeface-spectral"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ tags:
}
```

You can also manually mark in your markdown where to stop excerpting—similar to Jekyl. `gatsby-transformer-remark` uses [gray-matter]() to parse markdown frontmatter, so you can specify an excerpt_separator, as well as any of the other options mentioned [here](), in the `gatsby-config.js` file.
You can also manually mark in your markdown where to stop excerpting—similar to Jekyl. `gatsby-transformer-remark` uses [gray-matter](https://github.com/jonschlinkert/gray-matter) to parse markdown frontmatter, so you can specify an `excerpt_separator`, as well as any of the other options mentioned [here](https://github.com/jonschlinkert/gray-matter#options), in the `gatsby-config.js` file.

```json
{
Expand All @@ -33,6 +33,6 @@ You can also manually mark in your markdown where to stop excerpting—similar t
}
```

Any file that does not have the given excerpt_separator will fall back to the default pruning method.
Any file that does not have the given `excerpt_separator` will fall back to the default pruning method.

You can see the results [here](/excerpt-example)
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ author: Daisy Buchanan

This example uses a custom excerpt_separator.

You can manually mark in your markdown where to stop excerpting—similar to Jekyl. `gatsby-transformer-remark` uses [gray-matter]() to parse markdown frontmatter, so you can specify an excerpt_separator, as well as any of the other options mentioned [here](), in the `gatsby-config.js` file.
You can manually mark in your markdown where to stop excerpting—similar to Jekyll. <!-- end -->`gatsby-transformer-remark` uses [gray-matter](https://github.com/jonschlinkert/gray-matter) to parse markdown frontmatter, so you can specify an `excerpt_separator`, as well as any of the other options mentioned [here](https://github.com/jonschlinkert/gray-matter#options), in the `gatsby-config.js` file.

<!-- end -->

```json
{
Expand All @@ -20,4 +19,4 @@ You can manually mark in your markdown where to stop excerpting—similar to Jek
}
```

Any file that does not have the given excerpt_separator will fall back to the default pruning method.
Any file that does not have the given `excerpt_separator` will fall back to the default pruning method.
2 changes: 1 addition & 1 deletion examples/using-remark/src/templates/template-blog-post.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import rehypeReact from "rehype-react"

import styles from "../styles"
import { rhythm, scale } from "../utils/typography"
import presets from "../utils/presets"
import Counter from "../components/Counter"

import "katex/dist/katex.min.css"
Expand Down Expand Up @@ -99,6 +98,7 @@ class BlogPostRoute extends React.Component {
marginRight: rhythm(3 / 4),
marginBottom: 0,
}}
Tag="span"
/>
<span
css={{
Expand Down
8 changes: 5 additions & 3 deletions packages/gatsby-plugin-catch-links/src/gatsby-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { navigateTo } from "gatsby-link"

import catchLinks from "./catch-links"

catchLinks(window, href => {
navigateTo(href)
})
exports.onClientEntry = () => {
catchLinks(window, href => {
navigateTo(href)
})
}
8 changes: 5 additions & 3 deletions packages/gatsby-plugin-typography/src/gatsby-browser.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import typography from "gatsby-plugin-typography/.cache/typography.js"

// Hot reload typography in development.
if (process.env.NODE_ENV !== `production`) {
typography.injectStyles()
exports.onClientEntry = () => {
// Hot reload typography in development.
if (process.env.NODE_ENV !== `production`) {
typography.injectStyles()
}
}

0 comments on commit afa6a5c

Please sign in to comment.