x0 icon indicating copy to clipboard operation
x0 copied to clipboard

Expose @mdx-js/loader configuration

Open silvenon opened this issue 7 years ago • 0 comments

I'm not sure if there's currently a way to extend or override MDX configuration. One way could be to use smart merging. Another way could be to add a mdx field in x0 configuration in package.json:

"x0": {
  "mdx": "./mdx.config.js"
}
// mdx.config.js
const math = require('remark-math')
const katex = require('rehype-katex')

module.exports = ({ defaultMdPlugins, defaultHastPlugins }) => ({
  mdPlugins: [
    ...defaultMdPlugins,
    math,
  ],
  hastPlugins: [
    ...defaultHastPlugins,
    katext,
  ],
})

I prefer the latter strategy. Even though it results in an additional configuration file, it's probably more straightforward to implement and use.

silvenon avatar Sep 17 '18 19:09 silvenon