syntra / gatsby-remark-reading-time

Gatsby remark plugin to add an estimated reading time field to all remark nodes
MIT License
25 stars 16 forks source link

Add support for MDX #5

Closed tgallacher closed 5 years ago

tgallacher commented 5 years ago

First, thanks for this plugin!

Summary

Adds support for the Mdx node type provided via gatsby-plugin-mdx.

Although gatsby-plugin-mdx provides a similar metric via timeToRead field, I believe this plugin continues to offer value alongside the mdx plugin, as it provides additional formatting options.

Notes

  1. To have this work with gatsby-plugin-mdx, this plugin needs to live outside of the gatsby-plugin-mdx options, e.g remarkPlugins or gatsbyRemarkPlugins. For example,

// gatsby-config.js
  ...
  plugins: [
    {
      resolve: `gatsby-plugin-mdx`,
      options: {
        gatsbyRemarkPlugins: [...],
        remarkPlugins: [...],
      },
    },
    'gatsby-remark-reading-time',
     ...
  ],
tgallacher commented 5 years ago

Thanks for merging this!

I've created a follow up PR (#7) to add instructions on how to use the MDX feature.