gatsby-remark-import-code
Install
$ npm install gatsby-remark-import-code
Use
Use it together with gatsby-plugin-mdx. In gatsby-config.js
:
moduleexports = plugins: resolve: `gatsby-plugin-mdx` options: gatsbyRemarkPlugins: `gatsby-remark-import-code` ;
It transforms md/mdx code blocks from this:
```js file=./hello-world.js```
into:
```jsfunction helloWorld() { return "hello world";}```