I’m trying to grab excerpts from my markdown files up to a specified separator, similar to how they’re handled by graymatter and jekyll link. Seeing as how this plugin uses graymatter under-the-hood, is there any way to access this functionality?
gatsby-transformer-remark version - 1.7.19
gatsby version - 1.9.73
Okay! It looks like graymatter accepts an object as a second parameter after content where you can specify whether to get an excerpt and what the excerpt should be. Any idea what the best way to add this functionality would be? Would it be better as a custom plugin, or would it be useful to add this functionality to the main remark plugin?
Sorry if I'm asking a lot. I'm new to working with Gatsby
Just noticed this. gatsby-transformer-remark relies version 2.1 of graymatter, but the excerpt options were added in version 3.0. I tried updating it in the plugin and tests seem to pass after updating the snapshot
Oh sweet! Would you like to put together a PR that upgrades gray-matter and documents how to add excerpt support?
You'd also need to modify the existing excerpt functionality to check if there's an excerpt already set and use that instead of generating a new one https://github.com/gatsbyjs/gatsby/blob/6ff3bc38b97ed4185bd97b7f90e10d580abcbb2d/packages/gatsby-transformer-remark/src/extend-node-type.js#L262
Sure, I can take a look at that!
Bump, any way to change the excerpt pruneLength from the 140 default?
We should close this since it was taken care of in this PR https://github.com/gatsbyjs/gatsby/pull/2883.
@fxfactorial You can updated the pruneLength in your graphql https://using-remark.gatsbyjs.org/excerpts/
appreciate it!
On Apr 6, 2018, at 10:52 AM, Ben Wilcox notifications@github.com wrote:
We should close this since it was taken care of in this PR #2883 https://github.com/gatsbyjs/gatsby/pull/2883.
@fxfactorial https://github.com/fxfactorial You can updated the pruneLength in your graphql https://using-remark.gatsbyjs.org/excerpts/ https://using-remark.gatsbyjs.org/excerpts/
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/gatsbyjs/gatsby/issues/2794#issuecomment-379328400, or mute the thread https://github.com/notifications/unsubscribe-auth/AC5WkAMxN-VATQmvItpDwOQiFSvM41xzks5tl6t4gaJpZM4QSMmW.
Closing this issue, as this was already resolved as mentioned by @reccanti
Most helpful comment
Oh sweet! Would you like to put together a PR that upgrades gray-matter and documents how to add excerpt support?
You'd also need to modify the existing excerpt functionality to check if there's an excerpt already set and use that instead of generating a new one https://github.com/gatsbyjs/gatsby/blob/6ff3bc38b97ed4185bd97b7f90e10d580abcbb2d/packages/gatsby-transformer-remark/src/extend-node-type.js#L262