nuxt-modules / mdc

MDC supercharges regular Markdown to write documents interacting deeply with any Vue component.
MIT License
180 stars 22 forks source link

How to add remark and rehype plugins #242

Open imlautaro opened 1 month ago

imlautaro commented 1 month ago

I've been trying to add the plugins "remark-math" and "rehype-mathjax" to the MDC configuration but it doesn't work and the "docs" are not clear about that.

It works with the @nuxt/content module, but I need it to work with the MDC module because my markdown is coming from a database, not from the content directory.

What I tried in my nuxt.config.ts file:

mdc: {
  remarkPlugins: {
    remarkMath: {
        src: 'remark-math',
    },
},
rehypePlugins: {
    rehypeMathjax: {
        src: 'rehype-mathjax',
    },
  },
},
JoaoVCMiranda commented 1 month ago

Hi there!

Thank you for sharing, I'm facing a similar issue but with content directories

But I tried to use the CDN approach. And nuxt wouldn't let me have a tag in the tree.

With CDN you would need to do something about the "hydration" module on nuxt (Which I'm not sure yet of how it works).