Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(gatsby-transformer-remark): Revert/remark sources from different sources #12639

Merged
merged 3 commits into from
Mar 18, 2019
Prev Previous commit
replace graphql inline type with const
  • Loading branch information
wardpeet committed Mar 18, 2019
commit 2d95d929e8271b40676688258b7c8e5bdd634c78
30 changes: 16 additions & 14 deletions packages/gatsby-transformer-remark/src/extend-node-type.js
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,21 @@ module.exports = (
},
})

const WordCountType = new GraphQLObjectType({
name: `wordCount`,
fields: {
paragraphs: {
type: GraphQLInt,
},
sentences: {
type: GraphQLInt,
},
words: {
type: GraphQLInt,
},
},
})

return resolve({
html: {
type: GraphQLString,
Expand Down Expand Up @@ -602,20 +617,7 @@ module.exports = (
},
// TODO add support for non-latin languages https://github.com/wooorm/remark/issues/251#issuecomment-296731071
wordCount: {
type: new GraphQLObjectType({
name: `wordCount`,
fields: {
paragraphs: {
type: GraphQLInt,
},
sentences: {
type: GraphQLInt,
},
words: {
type: GraphQLInt,
},
},
}),
type: WordCountType,
resolve(markdownNode) {
let counts = {}

Expand Down